Merge pull request #122 from PavelSindler/MK2

Multimaterial stop print extended, selftest fixed, XYZ cal. improved, unload filament reverted
This commit is contained in:
XPila 2017-06-22 11:49:05 +02:00 committed by GitHub
commit 01d21c3e14
26 changed files with 8873 additions and 7994 deletions

View File

@ -5,11 +5,10 @@
#include "Configuration_prusa.h" #include "Configuration_prusa.h"
// Firmware version // Firmware version
#define FW_version "3.0.12-RC1" #define FW_version "3.0.12-RC2"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10 #define FW_PRUSA3D_MAGIC_LEN 10
// The total size of the EEPROM is // The total size of the EEPROM is
// 4096 for the Atmega2560 // 4096 for the Atmega2560
#define EEPROM_TOP 4096 #define EEPROM_TOP 4096

View File

@ -1,347 +1,351 @@
// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware. // Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
// License: GPL // License: GPL
#ifndef MARLIN_H #ifndef MARLIN_H
#define MARLIN_H #define MARLIN_H
#define FORCE_INLINE __attribute__((always_inline)) inline #define FORCE_INLINE __attribute__((always_inline)) inline
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include <util/delay.h> #include <util/delay.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/eeprom.h> #include <avr/eeprom.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include "fastio.h" #include "fastio.h"
#include "Configuration.h" #include "Configuration.h"
#include "pins.h" #include "pins.h"
#ifndef AT90USB #ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#endif #endif
#if (ARDUINO >= 100) #if (ARDUINO >= 100)
# include "Arduino.h" # include "Arduino.h"
#else #else
# include "WProgram.h" # include "WProgram.h"
#endif #endif
// Arduino < 1.0.0 does not define this, so we need to do it ourselves // Arduino < 1.0.0 does not define this, so we need to do it ourselves
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
# define analogInputToDigitalPin(p) ((p) + A0) # define analogInputToDigitalPin(p) ((p) + A0)
#endif #endif
#ifdef AT90USB #ifdef AT90USB
#include "HardwareSerial.h" #include "HardwareSerial.h"
#endif #endif
#include "MarlinSerial.h" #include "MarlinSerial.h"
#ifndef cbi #ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif #endif
#ifndef sbi #ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif #endif
#include "WString.h" #include "WString.h"
#ifdef AT90USB #ifdef AT90USB
#ifdef BTENABLED #ifdef BTENABLED
#define MYSERIAL bt #define MYSERIAL bt
#else #else
#define MYSERIAL Serial #define MYSERIAL Serial
#endif // BTENABLED #endif // BTENABLED
#else #else
#define MYSERIAL MSerial #define MYSERIAL MSerial
#endif #endif
#define SERIAL_PROTOCOL(x) (MYSERIAL.print(x)) #define SERIAL_PROTOCOL(x) (MYSERIAL.print(x))
#define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y)) #define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y))
#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) #define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x)))
#define SERIAL_PROTOCOLRPGM(x) (serialprintPGM((x))) #define SERIAL_PROTOCOLRPGM(x) (serialprintPGM((x)))
#define SERIAL_PROTOCOLLN(x) (MYSERIAL.print(x),MYSERIAL.write('\n')) #define SERIAL_PROTOCOLLN(x) (MYSERIAL.print(x),MYSERIAL.write('\n'))
#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.write('\n')) #define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.write('\n'))
#define SERIAL_PROTOCOLLNRPGM(x) (serialprintPGM((x)),MYSERIAL.write('\n')) #define SERIAL_PROTOCOLLNRPGM(x) (serialprintPGM((x)),MYSERIAL.write('\n'))
extern const char errormagic[] PROGMEM; extern const char errormagic[] PROGMEM;
extern const char echomagic[] PROGMEM; extern const char echomagic[] PROGMEM;
#define SERIAL_ERROR_START (serialprintPGM(errormagic)) #define SERIAL_ERROR_START (serialprintPGM(errormagic))
#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x) #define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x) #define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
#define SERIAL_ERRORRPGM(x) SERIAL_PROTOCOLRPGM(x) #define SERIAL_ERRORRPGM(x) SERIAL_PROTOCOLRPGM(x)
#define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x)
#define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x) #define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_ERRORLNRPGM(x) SERIAL_PROTOCOLLNRPGM(x) #define SERIAL_ERRORLNRPGM(x) SERIAL_PROTOCOLLNRPGM(x)
#define SERIAL_ECHO_START (serialprintPGM(echomagic)) #define SERIAL_ECHO_START (serialprintPGM(echomagic))
#define SERIAL_ECHO(x) SERIAL_PROTOCOL(x) #define SERIAL_ECHO(x) SERIAL_PROTOCOL(x)
#define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x) #define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x)
#define SERIAL_ECHORPGM(x) SERIAL_PROTOCOLRPGM(x) #define SERIAL_ECHORPGM(x) SERIAL_PROTOCOLRPGM(x)
#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_ECHOLNRPGM(x) SERIAL_PROTOCOLLNRPGM(x) #define SERIAL_ECHOLNRPGM(x) SERIAL_PROTOCOLLNRPGM(x)
#define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value))) #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
void serial_echopair_P(const char *s_P, float v); void serial_echopair_P(const char *s_P, float v);
void serial_echopair_P(const char *s_P, double v); void serial_echopair_P(const char *s_P, double v);
void serial_echopair_P(const char *s_P, unsigned long v); void serial_echopair_P(const char *s_P, unsigned long v);
//Things to write to serial from Program memory. Saves 400 to 2k of RAM. //Things to write to serial from Program memory. Saves 400 to 2k of RAM.
FORCE_INLINE void serialprintPGM(const char *str) FORCE_INLINE void serialprintPGM(const char *str)
{ {
char ch=pgm_read_byte(str); char ch=pgm_read_byte(str);
while(ch) while(ch)
{ {
MYSERIAL.write(ch); MYSERIAL.write(ch);
ch=pgm_read_byte(++str); ch=pgm_read_byte(++str);
} }
} }
bool is_buffer_empty(); bool is_buffer_empty();
void get_command(); void get_command();
void process_commands(); void process_commands();
void ramming(); void ramming();
void manage_inactivity(bool ignore_stepper_queue=false); void manage_inactivity(bool ignore_stepper_queue=false);
#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 #if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
#define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON) #define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
#define disable_x() { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } #define disable_x() { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#else #else
#define enable_x() ; #define enable_x() ;
#define disable_x() ; #define disable_x() ;
#endif #endif
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1 #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
#ifdef Y_DUAL_STEPPER_DRIVERS #ifdef Y_DUAL_STEPPER_DRIVERS
#define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); } #define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); }
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } #define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else #else
#define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON) #define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } #define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif #endif
#else #else
#define enable_y() ; #define enable_y() ;
#define disable_y() ; #define disable_y() ;
#endif #endif
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1 #if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
#if defined(Z_AXIS_ALWAYS_ON) #if defined(Z_AXIS_ALWAYS_ON)
#ifdef Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS
#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); } #define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else #else
#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON) #define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define disable_z() ; #define disable_z() ;
#endif #endif
#else #else
#ifdef Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS
#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); } #define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else #else
#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON) #define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#endif #endif
#endif #endif
#else #else
#define enable_z() ; #define enable_z() ;
#define disable_z() ; #define disable_z() ;
#endif #endif
//#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1 //#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
//#ifdef Z_DUAL_STEPPER_DRIVERS //#ifdef Z_DUAL_STEPPER_DRIVERS
//#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); } //#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
//#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } //#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
//#else //#else
//#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON) //#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
//#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } //#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
//#endif //#endif
//#else //#else
//#define enable_z() ; //#define enable_z() ;
//#define disable_z() ; //#define disable_z() ;
//#endif //#endif
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1) #if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
#define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON) #define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON)
#define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON) #define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON)
#else #else
#define enable_e0() /* nothing */ #define enable_e0() /* nothing */
#define disable_e0() /* nothing */ #define disable_e0() /* nothing */
#endif #endif
#if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1) #if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON) #define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON) #define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#else #else
#define enable_e1() /* nothing */ #define enable_e1() /* nothing */
#define disable_e1() /* nothing */ #define disable_e1() /* nothing */
#endif #endif
#if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1) #if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON) #define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON) #define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#else #else
#define enable_e2() /* nothing */ #define enable_e2() /* nothing */
#define disable_e2() /* nothing */ #define disable_e2() /* nothing */
#endif #endif
enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ClearToSend(); void ClearToSend();
void get_coordinates(); void get_coordinates();
void prepare_move(); void prepare_move();
void kill(const char *full_screen_message = NULL); void kill(const char *full_screen_message = NULL);
void Stop(); void Stop();
bool IsStopped(); bool IsStopped();
//put an ASCII command at the end of the current buffer. //put an ASCII command at the end of the current buffer.
void enquecommand(const char *cmd, bool from_progmem = false); void enquecommand(const char *cmd, bool from_progmem = false);
//put an ASCII command at the end of the current buffer, read from flash //put an ASCII command at the end of the current buffer, read from flash
#define enquecommand_P(cmd) enquecommand(cmd, true) #define enquecommand_P(cmd) enquecommand(cmd, true)
void enquecommand_front(const char *cmd, bool from_progmem = false); void enquecommand_front(const char *cmd, bool from_progmem = false);
//put an ASCII command at the end of the current buffer, read from flash //put an ASCII command at the end of the current buffer, read from flash
#define enquecommand_P(cmd) enquecommand(cmd, true) #define enquecommand_P(cmd) enquecommand(cmd, true)
#define enquecommand_front_P(cmd) enquecommand_front(cmd, true) #define enquecommand_front_P(cmd) enquecommand_front(cmd, true)
void repeatcommand_front(); void repeatcommand_front();
// Remove all lines from the command queue. // Remove all lines from the command queue.
void cmdqueue_reset(); void cmdqueue_reset();
void prepare_arc_move(char isclockwise); void prepare_arc_move(char isclockwise);
void clamp_to_software_endstops(float target[3]); void clamp_to_software_endstops(float target[3]);
void refresh_cmd_timeout(void); void refresh_cmd_timeout(void);
#ifdef FAST_PWM_FAN #ifdef FAST_PWM_FAN
void setPwmFrequency(uint8_t pin, int val); void setPwmFrequency(uint8_t pin, int val);
#endif #endif
#ifndef CRITICAL_SECTION_START #ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli(); #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
#define CRITICAL_SECTION_END SREG = _sreg; #define CRITICAL_SECTION_END SREG = _sreg;
#endif //CRITICAL_SECTION_START #endif //CRITICAL_SECTION_START
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;
extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
extern bool volumetric_enabled; extern bool volumetric_enabled;
extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
extern float current_position[NUM_AXIS] ; extern float current_position[NUM_AXIS] ;
extern float destination[NUM_AXIS] ; extern float destination[NUM_AXIS] ;
extern float add_homing[3]; extern float add_homing[3];
extern float min_pos[3]; extern float min_pos[3];
extern float max_pos[3]; extern float max_pos[3];
extern bool axis_known_position[3]; extern bool axis_known_position[3];
extern float zprobe_zoffset; extern float zprobe_zoffset;
extern int fanSpeed; extern int fanSpeed;
extern void homeaxis(int axis); extern void homeaxis(int axis);
#ifdef FAN_SOFT_PWM #ifdef FAN_SOFT_PWM
extern unsigned char fanSpeedSoftPwm; extern unsigned char fanSpeedSoftPwm;
#endif #endif
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
extern float filament_width_nominal; //holds the theoretical filament diameter ie., 3.00 or 1.75 extern float filament_width_nominal; //holds the theoretical filament diameter ie., 3.00 or 1.75
extern bool filament_sensor; //indicates that filament sensor readings should control extrusion extern bool filament_sensor; //indicates that filament sensor readings should control extrusion
extern float filament_width_meas; //holds the filament diameter as accurately measured extern float filament_width_meas; //holds the filament diameter as accurately measured
extern signed char measurement_delay[]; //ring buffer to delay measurement extern signed char measurement_delay[]; //ring buffer to delay measurement
extern int delay_index1, delay_index2; //index into ring buffer extern int delay_index1, delay_index2; //index into ring buffer
extern float delay_dist; //delay distance counter extern float delay_dist; //delay distance counter
extern int meas_delay_cm; //delay distance extern int meas_delay_cm; //delay distance
#endif #endif
#ifdef FWRETRACT #ifdef FWRETRACT
extern bool autoretract_enabled; extern bool autoretract_enabled;
extern bool retracted[EXTRUDERS]; extern bool retracted[EXTRUDERS];
extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift; extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate; extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
#endif #endif
extern unsigned long starttime; extern unsigned long starttime;
extern unsigned long stoptime; extern unsigned long stoptime;
extern int bowden_length[4]; extern int bowden_length[4];
extern bool is_usb_printing; extern bool is_usb_printing;
extern bool homing_flag; extern bool homing_flag;
extern bool temp_cal_active; extern bool temp_cal_active;
extern bool loading_flag; extern bool loading_flag;
extern unsigned int usb_printing_counter; extern unsigned int usb_printing_counter;
extern unsigned long kicktime; extern unsigned long kicktime;
extern unsigned long total_filament_used; extern unsigned long total_filament_used;
void save_statistics(unsigned long _total_filament_used, unsigned long _total_print_time); void save_statistics(unsigned long _total_filament_used, unsigned long _total_print_time);
extern unsigned int heating_status; extern unsigned int heating_status;
extern unsigned int status_number; extern unsigned int status_number;
extern unsigned int heating_status_counter; extern unsigned int heating_status_counter;
extern bool custom_message; extern bool custom_message;
extern unsigned int custom_message_type; extern unsigned int custom_message_type;
extern unsigned int custom_message_state; extern unsigned int custom_message_state;
extern unsigned long PingTime; extern char snmm_filaments_used;
extern unsigned long PingTime;
// Handling multiple extruders pins
extern uint8_t active_extruder; // Handling multiple extruders pins
extern uint8_t active_extruder;
#ifdef DIGIPOT_I2C
extern void digipot_i2c_set_current( int channel, float current ); #ifdef DIGIPOT_I2C
extern void digipot_i2c_init(); extern void digipot_i2c_set_current( int channel, float current );
#endif extern void digipot_i2c_init();
#endif
#endif
#endif
//Long pause
extern int saved_feedmultiply; //Long pause
extern float HotendTempBckp; extern int saved_feedmultiply;
extern int fanSpeedBckp; extern float HotendTempBckp;
extern float pause_lastpos[4]; extern int fanSpeedBckp;
extern unsigned long pause_time; extern float pause_lastpos[4];
extern unsigned long start_pause_print; extern unsigned long pause_time;
extern unsigned long start_pause_print;
extern bool mesh_bed_leveling_flag;
extern bool mesh_bed_run_from_menu; extern bool mesh_bed_leveling_flag;
extern bool mesh_bed_run_from_menu;
extern void calculate_volumetric_multipliers();
extern float distance_from_min[3];
// Similar to the default Arduino delay function, extern float angleDiff;
// but it keeps the background tasks running.
extern void delay_keep_alive(unsigned int ms); extern void calculate_volumetric_multipliers();
extern void check_babystep(); // Similar to the default Arduino delay function,
// but it keeps the background tasks running.
extern void long_pause(); extern void delay_keep_alive(unsigned int ms);
#ifdef DIS extern void check_babystep();
void d_setup(); extern void long_pause();
float d_ReadData();
void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); #ifdef DIS
#endif void d_setup();
float temp_comp_interpolation(float temperature); float d_ReadData();
void temp_compensation_apply(); void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y);
void temp_compensation_start();
void wait_for_heater(long codenum); #endif
float temp_comp_interpolation(float temperature);
void temp_compensation_apply();
void temp_compensation_start();
void wait_for_heater(long codenum);
void serialecho_temperatures(); void serialecho_temperatures();

View File

@ -285,6 +285,10 @@ bool custom_message;
bool loading_flag = false; bool loading_flag = false;
unsigned int custom_message_type; unsigned int custom_message_type;
unsigned int custom_message_state; unsigned int custom_message_state;
char snmm_filaments_used = 0;
float distance_from_min[3];
float angleDiff;
bool volumetric_enabled = false; bool volumetric_enabled = false;
float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA
@ -2299,12 +2303,11 @@ void process_commands()
prepare_arc_move(false); prepare_arc_move(false);
} }
break; break;
case 4: // G4 dwell case 4: // G4 dwell
LCD_MESSAGERPGM(MSG_DWELL);
codenum = 0; codenum = 0;
if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('P')) codenum = code_value(); // milliseconds to wait
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
if(codenum != 0) LCD_MESSAGERPGM(MSG_DWELL);
st_synchronize(); st_synchronize();
codenum += millis(); // keep track of when we started waiting codenum += millis(); // keep track of when we started waiting
previous_millis_cmd = millis(); previous_millis_cmd = millis();
@ -2754,7 +2757,7 @@ void process_commands()
clean_up_after_endstop_move(); clean_up_after_endstop_move();
} }
break; break;
case 75: case 75:
{ {
@ -3655,14 +3658,15 @@ void process_commands()
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0); eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
// Complete XYZ calibration. // Complete XYZ calibration.
BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level); uint8_t point_too_far_mask = 0;
uint8_t point_too_far_mask = 0; BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
clean_up_after_endstop_move(); clean_up_after_endstop_move();
// Print head up. // Print head up.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder);
st_synchronize(); st_synchronize();
if (result >= 0) { if (result >= 0) {
point_too_far_mask = 0;
// Second half: The fine adjustment. // Second half: The fine adjustment.
// Let the planner use the uncorrected coordinates. // Let the planner use the uncorrected coordinates.
mbl.reset(); mbl.reset();
@ -4301,6 +4305,7 @@ Sigma_Exit:
#endif #endif
} }
} }
snmm_filaments_used = 0;
break; break;
case 85: // M85 case 85: // M85
if(code_seen('S')) { if(code_seen('S')) {
@ -4451,7 +4456,7 @@ Sigma_Exit:
tmp_extruder = active_extruder; tmp_extruder = active_extruder;
if(code_seen('T')) { if(code_seen('T')) {
tmp_extruder = code_value(); tmp_extruder = code_value();
if(tmp_extruder >= EXTRUDERS) { if(tmp_extruder >= EXTRUDERS) {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER); SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
break; break;
@ -5441,13 +5446,19 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
case 702: case 702:
{ {
#ifdef SNMM #ifdef SNMM
extr_unload_all(); if (code_seen('U')) {
extr_unload_used(); //unload all filaments which were used in current print
}
else if (code_seen('C')) {
extr_unload(); //unload just current filament
}
else {
extr_unload_all(); //unload all filaments
}
#else #else
custom_message = true; custom_message = true;
custom_message_type = 2; custom_message_type = 2;
lcd_setstatuspgm(MSG_UNLOADING_FILAMENT); lcd_setstatuspgm(MSG_UNLOADING_FILAMENT);
current_position[E_AXIS] += 3;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder);
current_position[E_AXIS] -= 80; current_position[E_AXIS] -= 80;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 7000 / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 7000 / 60, active_extruder);
st_synchronize(); st_synchronize();
@ -5474,11 +5485,17 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
int index; int index;
for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++); for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++);
if (*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') { if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') && *(strchr_pointer + index) != '?') {
SERIAL_ECHOLNPGM("Invalid T code."); SERIAL_ECHOLNPGM("Invalid T code.");
} }
else { else {
tmp_extruder = code_value(); if (*(strchr_pointer + index) == '?') {
tmp_extruder = choose_extruder_menu();
}
else {
tmp_extruder = code_value();
}
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
#ifdef SNMM #ifdef SNMM
snmm_extruder = tmp_extruder; snmm_extruder = tmp_extruder;

File diff suppressed because it is too large Load Diff

View File

@ -1,262 +1,262 @@
/* Arduino Sd2Card Library /* Arduino Sd2Card Library
* Copyright (C) 2009 by William Greiman * Copyright (C) 2009 by William Greiman
* *
* This file is part of the Arduino Sd2Card Library * This file is part of the Arduino Sd2Card Library
* *
* This Library is free software: you can redistribute it and/or modify * This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This Library is distributed in the hope that it will be useful, * This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the Arduino Sd2Card Library. If not, see * along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h" #include "Marlin.h"
#ifdef SDSUPPORT #ifdef SDSUPPORT
#ifndef Sd2Card_h #ifndef Sd2Card_h
#define Sd2Card_h #define Sd2Card_h
/** /**
* \file * \file
* \brief Sd2Card class for V2 SD/SDHC cards * \brief Sd2Card class for V2 SD/SDHC cards
*/ */
#include "SdFatConfig.h" #include "SdFatConfig.h"
#include "Sd2PinMap.h" #include "Sd2PinMap.h"
#include "SdInfo.h" #include "SdInfo.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// SPI speed is F_CPU/2^(1 + index), 0 <= index <= 6 // SPI speed is F_CPU/2^(1 + index), 0 <= index <= 6
/** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */ /** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */
uint8_t const SPI_FULL_SPEED = 0; uint8_t const SPI_FULL_SPEED = 0;
/** Set SCK rate to F_CPU/4. See Sd2Card::setSckRate(). */ /** Set SCK rate to F_CPU/4. See Sd2Card::setSckRate(). */
uint8_t const SPI_HALF_SPEED = 1; uint8_t const SPI_HALF_SPEED = 1;
/** Set SCK rate to F_CPU/8. See Sd2Card::setSckRate(). */ /** Set SCK rate to F_CPU/8. See Sd2Card::setSckRate(). */
uint8_t const SPI_QUARTER_SPEED = 2; uint8_t const SPI_QUARTER_SPEED = 2;
/** Set SCK rate to F_CPU/16. See Sd2Card::setSckRate(). */ /** Set SCK rate to F_CPU/16. See Sd2Card::setSckRate(). */
uint8_t const SPI_EIGHTH_SPEED = 3; uint8_t const SPI_EIGHTH_SPEED = 3;
/** Set SCK rate to F_CPU/32. See Sd2Card::setSckRate(). */ /** Set SCK rate to F_CPU/32. See Sd2Card::setSckRate(). */
uint8_t const SPI_SIXTEENTH_SPEED = 4; uint8_t const SPI_SIXTEENTH_SPEED = 4;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** init timeout ms */ /** init timeout ms */
uint16_t const SD_INIT_TIMEOUT = 2000; uint16_t const SD_INIT_TIMEOUT = 2000;
/** erase timeout ms */ /** erase timeout ms */
uint16_t const SD_ERASE_TIMEOUT = 10000; uint16_t const SD_ERASE_TIMEOUT = 10000;
/** read timeout ms */ /** read timeout ms */
uint16_t const SD_READ_TIMEOUT = 300; uint16_t const SD_READ_TIMEOUT = 300;
/** write time out ms */ /** write time out ms */
uint16_t const SD_WRITE_TIMEOUT = 600; uint16_t const SD_WRITE_TIMEOUT = 600;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// SD card errors // SD card errors
/** timeout error for command CMD0 (initialize card in SPI mode) */ /** timeout error for command CMD0 (initialize card in SPI mode) */
uint8_t const SD_CARD_ERROR_CMD0 = 0X1; uint8_t const SD_CARD_ERROR_CMD0 = 0X1;
/** CMD8 was not accepted - not a valid SD card*/ /** CMD8 was not accepted - not a valid SD card*/
uint8_t const SD_CARD_ERROR_CMD8 = 0X2; uint8_t const SD_CARD_ERROR_CMD8 = 0X2;
/** card returned an error response for CMD12 (write stop) */ /** card returned an error response for CMD12 (write stop) */
uint8_t const SD_CARD_ERROR_CMD12 = 0X3; uint8_t const SD_CARD_ERROR_CMD12 = 0X3;
/** card returned an error response for CMD17 (read block) */ /** card returned an error response for CMD17 (read block) */
uint8_t const SD_CARD_ERROR_CMD17 = 0X4; uint8_t const SD_CARD_ERROR_CMD17 = 0X4;
/** card returned an error response for CMD18 (read multiple block) */ /** card returned an error response for CMD18 (read multiple block) */
uint8_t const SD_CARD_ERROR_CMD18 = 0X5; uint8_t const SD_CARD_ERROR_CMD18 = 0X5;
/** card returned an error response for CMD24 (write block) */ /** card returned an error response for CMD24 (write block) */
uint8_t const SD_CARD_ERROR_CMD24 = 0X6; uint8_t const SD_CARD_ERROR_CMD24 = 0X6;
/** WRITE_MULTIPLE_BLOCKS command failed */ /** WRITE_MULTIPLE_BLOCKS command failed */
uint8_t const SD_CARD_ERROR_CMD25 = 0X7; uint8_t const SD_CARD_ERROR_CMD25 = 0X7;
/** card returned an error response for CMD58 (read OCR) */ /** card returned an error response for CMD58 (read OCR) */
uint8_t const SD_CARD_ERROR_CMD58 = 0X8; uint8_t const SD_CARD_ERROR_CMD58 = 0X8;
/** SET_WR_BLK_ERASE_COUNT failed */ /** SET_WR_BLK_ERASE_COUNT failed */
uint8_t const SD_CARD_ERROR_ACMD23 = 0X9; uint8_t const SD_CARD_ERROR_ACMD23 = 0X9;
/** ACMD41 initialization process timeout */ /** ACMD41 initialization process timeout */
uint8_t const SD_CARD_ERROR_ACMD41 = 0XA; uint8_t const SD_CARD_ERROR_ACMD41 = 0XA;
/** card returned a bad CSR version field */ /** card returned a bad CSR version field */
uint8_t const SD_CARD_ERROR_BAD_CSD = 0XB; uint8_t const SD_CARD_ERROR_BAD_CSD = 0XB;
/** erase block group command failed */ /** erase block group command failed */
uint8_t const SD_CARD_ERROR_ERASE = 0XC; uint8_t const SD_CARD_ERROR_ERASE = 0XC;
/** card not capable of single block erase */ /** card not capable of single block erase */
uint8_t const SD_CARD_ERROR_ERASE_SINGLE_BLOCK = 0XD; uint8_t const SD_CARD_ERROR_ERASE_SINGLE_BLOCK = 0XD;
/** Erase sequence timed out */ /** Erase sequence timed out */
uint8_t const SD_CARD_ERROR_ERASE_TIMEOUT = 0XE; uint8_t const SD_CARD_ERROR_ERASE_TIMEOUT = 0XE;
/** card returned an error token instead of read data */ /** card returned an error token instead of read data */
uint8_t const SD_CARD_ERROR_READ = 0XF; uint8_t const SD_CARD_ERROR_READ = 0XF;
/** read CID or CSD failed */ /** read CID or CSD failed */
uint8_t const SD_CARD_ERROR_READ_REG = 0X10; uint8_t const SD_CARD_ERROR_READ_REG = 0X10;
/** timeout while waiting for start of read data */ /** timeout while waiting for start of read data */
uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0X11; uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0X11;
/** card did not accept STOP_TRAN_TOKEN */ /** card did not accept STOP_TRAN_TOKEN */
uint8_t const SD_CARD_ERROR_STOP_TRAN = 0X12; uint8_t const SD_CARD_ERROR_STOP_TRAN = 0X12;
/** card returned an error token as a response to a write operation */ /** card returned an error token as a response to a write operation */
uint8_t const SD_CARD_ERROR_WRITE = 0X13; uint8_t const SD_CARD_ERROR_WRITE = 0X13;
/** attempt to write protected block zero */ /** attempt to write protected block zero */
uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0X14; // REMOVE - not used uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0X14; // REMOVE - not used
/** card did not go ready for a multiple block write */ /** card did not go ready for a multiple block write */
uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0X15; uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0X15;
/** card returned an error to a CMD13 status check after a write */ /** card returned an error to a CMD13 status check after a write */
uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0X16; uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0X16;
/** timeout occurred during write programming */ /** timeout occurred during write programming */
uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0X17; uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0X17;
/** incorrect rate selected */ /** incorrect rate selected */
uint8_t const SD_CARD_ERROR_SCK_RATE = 0X18; uint8_t const SD_CARD_ERROR_SCK_RATE = 0X18;
/** init() not called */ /** init() not called */
uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED = 0X19; uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED = 0X19;
/** crc check error */ /** crc check error */
uint8_t const SD_CARD_ERROR_CRC = 0X20; uint8_t const SD_CARD_ERROR_CRC = 0X20;
/** Toshiba FlashAir: iSDIO */ /** Toshiba FlashAir: iSDIO */
uint8_t const SD_CARD_ERROR_CMD48 = 0x80; uint8_t const SD_CARD_ERROR_CMD48 = 0x80;
/** Toshiba FlashAir: iSDIO */ /** Toshiba FlashAir: iSDIO */
uint8_t const SD_CARD_ERROR_CMD49 = 0x81; uint8_t const SD_CARD_ERROR_CMD49 = 0x81;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// card types // card types
/** Standard capacity V1 SD card */ /** Standard capacity V1 SD card */
uint8_t const SD_CARD_TYPE_SD1 = 1; uint8_t const SD_CARD_TYPE_SD1 = 1;
/** Standard capacity V2 SD card */ /** Standard capacity V2 SD card */
uint8_t const SD_CARD_TYPE_SD2 = 2; uint8_t const SD_CARD_TYPE_SD2 = 2;
/** High Capacity SD card */ /** High Capacity SD card */
uint8_t const SD_CARD_TYPE_SDHC = 3; uint8_t const SD_CARD_TYPE_SDHC = 3;
/** /**
* define SOFTWARE_SPI to use bit-bang SPI * define SOFTWARE_SPI to use bit-bang SPI
*/ */
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if MEGA_SOFT_SPI && (defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__)) #if MEGA_SOFT_SPI && (defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__))
#define SOFTWARE_SPI #define SOFTWARE_SPI
#elif USE_SOFTWARE_SPI #elif USE_SOFTWARE_SPI
#define SOFTWARE_SPI #define SOFTWARE_SPI
#endif // MEGA_SOFT_SPI #endif // MEGA_SOFT_SPI
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// SPI pin definitions - do not edit here - change in SdFatConfig.h // SPI pin definitions - do not edit here - change in SdFatConfig.h
// //
#ifndef SOFTWARE_SPI #ifndef SOFTWARE_SPI
// hardware pin defs // hardware pin defs
/** The default chip select pin for the SD card is SS. */ /** The default chip select pin for the SD card is SS. */
uint8_t const SD_CHIP_SELECT_PIN = SS_PIN; uint8_t const SD_CHIP_SELECT_PIN = SS_PIN;
// The following three pins must not be redefined for hardware SPI. // The following three pins must not be redefined for hardware SPI.
/** SPI Master Out Slave In pin */ /** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = MOSI_PIN; uint8_t const SPI_MOSI_PIN = MOSI_PIN;
/** SPI Master In Slave Out pin */ /** SPI Master In Slave Out pin */
uint8_t const SPI_MISO_PIN = MISO_PIN; uint8_t const SPI_MISO_PIN = MISO_PIN;
/** SPI Clock pin */ /** SPI Clock pin */
uint8_t const SPI_SCK_PIN = SCK_PIN; uint8_t const SPI_SCK_PIN = SCK_PIN;
#else // SOFTWARE_SPI #else // SOFTWARE_SPI
/** SPI chip select pin */ /** SPI chip select pin */
uint8_t const SD_CHIP_SELECT_PIN = SOFT_SPI_CS_PIN; uint8_t const SD_CHIP_SELECT_PIN = SOFT_SPI_CS_PIN;
/** SPI Master Out Slave In pin */ /** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = SOFT_SPI_MOSI_PIN; uint8_t const SPI_MOSI_PIN = SOFT_SPI_MOSI_PIN;
/** SPI Master In Slave Out pin */ /** SPI Master In Slave Out pin */
uint8_t const SPI_MISO_PIN = SOFT_SPI_MISO_PIN; uint8_t const SPI_MISO_PIN = SOFT_SPI_MISO_PIN;
/** SPI Clock pin */ /** SPI Clock pin */
uint8_t const SPI_SCK_PIN = SOFT_SPI_SCK_PIN; uint8_t const SPI_SCK_PIN = SOFT_SPI_SCK_PIN;
#endif // SOFTWARE_SPI #endif // SOFTWARE_SPI
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* \class Sd2Card * \class Sd2Card
* \brief Raw access to SD and SDHC flash memory cards. * \brief Raw access to SD and SDHC flash memory cards.
*/ */
class Sd2Card { class Sd2Card {
public: public:
/** Construct an instance of Sd2Card. */ /** Construct an instance of Sd2Card. */
Sd2Card() : errorCode_(SD_CARD_ERROR_INIT_NOT_CALLED), type_(0), flash_air_compatible_(false) {} Sd2Card() : errorCode_(SD_CARD_ERROR_INIT_NOT_CALLED), type_(0), flash_air_compatible_(false) {}
uint32_t cardSize(); uint32_t cardSize();
bool erase(uint32_t firstBlock, uint32_t lastBlock); bool erase(uint32_t firstBlock, uint32_t lastBlock);
bool eraseSingleBlockEnable(); bool eraseSingleBlockEnable();
/** /**
* Set SD error code. * Set SD error code.
* \param[in] code value for error code. * \param[in] code value for error code.
*/ */
void error(uint8_t code) {errorCode_ = code;} void error(uint8_t code) {errorCode_ = code;}
/** /**
* \return error code for last error. See Sd2Card.h for a list of error codes. * \return error code for last error. See Sd2Card.h for a list of error codes.
*/ */
int errorCode() const {return errorCode_;} int errorCode() const {return errorCode_;}
/** \return error data for last error. */ /** \return error data for last error. */
int errorData() const {return status_;} int errorData() const {return status_;}
/** /**
* Initialize an SD flash memory card with default clock rate and chip * Initialize an SD flash memory card with default clock rate and chip
* select pin. See sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin). * select pin. See sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin).
* *
* \return true for success or false for failure. * \return true for success or false for failure.
*/ */
bool init(uint8_t sckRateID = SPI_FULL_SPEED, bool init(uint8_t sckRateID = SPI_FULL_SPEED,
uint8_t chipSelectPin = SD_CHIP_SELECT_PIN); uint8_t chipSelectPin = SD_CHIP_SELECT_PIN);
bool readBlock(uint32_t block, uint8_t* dst); bool readBlock(uint32_t block, uint8_t* dst);
/** /**
* Read a card's CID register. The CID contains card identification * Read a card's CID register. The CID contains card identification
* information such as Manufacturer ID, Product name, Product serial * information such as Manufacturer ID, Product name, Product serial
* number and Manufacturing date. * number and Manufacturing date.
* *
* \param[out] cid pointer to area for returned data. * \param[out] cid pointer to area for returned data.
* *
* \return true for success or false for failure. * \return true for success or false for failure.
*/ */
bool readCID(cid_t* cid) { bool readCID(cid_t* cid) {
return readRegister(CMD10, cid); return readRegister(CMD10, cid);
} }
/** /**
* Read a card's CSD register. The CSD contains Card-Specific Data that * Read a card's CSD register. The CSD contains Card-Specific Data that
* provides information regarding access to the card's contents. * provides information regarding access to the card's contents.
* *
* \param[out] csd pointer to area for returned data. * \param[out] csd pointer to area for returned data.
* *
* \return true for success or false for failure. * \return true for success or false for failure.
*/ */
bool readCSD(csd_t* csd) { bool readCSD(csd_t* csd) {
return readRegister(CMD9, csd); return readRegister(CMD9, csd);
} }
bool readData(uint8_t *dst); bool readData(uint8_t *dst);
bool readStart(uint32_t blockNumber); bool readStart(uint32_t blockNumber);
bool readStop(); bool readStop();
bool setSckRate(uint8_t sckRateID); bool setSckRate(uint8_t sckRateID);
/** Return the card type: SD V1, SD V2 or SDHC /** Return the card type: SD V1, SD V2 or SDHC
* \return 0 - SD V1, 1 - SD V2, or 3 - SDHC. * \return 0 - SD V1, 1 - SD V2, or 3 - SDHC.
*/ */
int type() const {return type_;} int type() const {return type_;}
bool writeBlock(uint32_t blockNumber, const uint8_t* src); bool writeBlock(uint32_t blockNumber, const uint8_t* src);
bool writeData(const uint8_t* src); bool writeData(const uint8_t* src);
bool writeStart(uint32_t blockNumber, uint32_t eraseCount); bool writeStart(uint32_t blockNumber, uint32_t eraseCount);
bool writeStop(); bool writeStop();
// Toshiba FlashAir support // Toshiba FlashAir support
uint8_t readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t* dst); uint8_t readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t* dst);
void setFlashAirCompatible(bool flashAirCompatible) { flash_air_compatible_ = flashAirCompatible; } void setFlashAirCompatible(bool flashAirCompatible) { flash_air_compatible_ = flashAirCompatible; }
bool getFlashAirCompatible() const { return flash_air_compatible_; } bool getFlashAirCompatible() const { return flash_air_compatible_; }
private: private:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
uint8_t chipSelectPin_; uint8_t chipSelectPin_;
uint8_t errorCode_; uint8_t errorCode_;
uint8_t spiRate_; uint8_t spiRate_;
uint8_t status_; uint8_t status_;
uint8_t type_; uint8_t type_;
bool flash_air_compatible_; bool flash_air_compatible_;
// private functions // private functions
uint8_t cardAcmd(uint8_t cmd, uint32_t arg) { uint8_t cardAcmd(uint8_t cmd, uint32_t arg) {
cardCommand(CMD55, 0); cardCommand(CMD55, 0);
return cardCommand(cmd, arg); return cardCommand(cmd, arg);
} }
uint8_t cardCommand(uint8_t cmd, uint32_t arg); uint8_t cardCommand(uint8_t cmd, uint32_t arg);
bool readData(uint8_t* dst, uint16_t count); bool readData(uint8_t* dst, uint16_t count);
bool readRegister(uint8_t cmd, void* buf); bool readRegister(uint8_t cmd, void* buf);
void chipSelectHigh(); void chipSelectHigh();
void chipSelectLow(); void chipSelectLow();
void type(uint8_t value) {type_ = value;} void type(uint8_t value) {type_ = value;}
bool waitNotBusy(uint16_t timeoutMillis); bool waitNotBusy(uint16_t timeoutMillis);
bool writeData(uint8_t token, const uint8_t* src); bool writeData(uint8_t token, const uint8_t* src);
// Toshiba FlashAir support // Toshiba FlashAir support
uint8_t waitStartBlock(void); uint8_t waitStartBlock(void);
uint8_t readExt(uint32_t arg, uint8_t* dst, uint16_t count); uint8_t readExt(uint32_t arg, uint8_t* dst, uint16_t count);
}; };
#endif // Sd2Card_h #endif // Sd2Card_h
#endif #endif

View File

@ -1,368 +1,368 @@
/* Arduino SdFat Library /* Arduino SdFat Library
* Copyright (C) 2010 by William Greiman * Copyright (C) 2010 by William Greiman
* *
* This file is part of the Arduino SdFat Library * This file is part of the Arduino SdFat Library
* *
* This Library is free software: you can redistribute it and/or modify * This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This Library is distributed in the hope that it will be useful, * This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
// Warning this file was generated by a program. // Warning this file was generated by a program.
#include "Marlin.h" #include "Marlin.h"
#ifdef SDSUPPORT #ifdef SDSUPPORT
#ifndef Sd2PinMap_h #ifndef Sd2PinMap_h
#define Sd2PinMap_h #define Sd2PinMap_h
#include <avr/io.h> #include <avr/io.h>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** struct for mapping digital pins */ /** struct for mapping digital pins */
struct pin_map_t { struct pin_map_t {
volatile uint8_t* ddr; volatile uint8_t* ddr;
volatile uint8_t* pin; volatile uint8_t* pin;
volatile uint8_t* port; volatile uint8_t* port;
uint8_t bit; uint8_t bit;
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if defined(__AVR_ATmega1280__)\ #if defined(__AVR_ATmega1280__)\
|| defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2560__)
// Mega // Mega
// Two Wire (aka I2C) ports // Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 20; // D1 uint8_t const SDA_PIN = 20; // D1
uint8_t const SCL_PIN = 21; // D0 uint8_t const SCL_PIN = 21; // D0
#undef MOSI_PIN #undef MOSI_PIN
#undef MISO_PIN #undef MISO_PIN
// SPI port // SPI port
uint8_t const SS_PIN = 53; // B0 uint8_t const SS_PIN = 53; // B0
uint8_t const MOSI_PIN = 51; // B2 uint8_t const MOSI_PIN = 51; // B2
uint8_t const MISO_PIN = 50; // B3 uint8_t const MISO_PIN = 50; // B3
uint8_t const SCK_PIN = 52; // B1 uint8_t const SCK_PIN = 52; // B1
static const pin_map_t digitalPinMap[] = { static const pin_map_t digitalPinMap[] = {
{&DDRE, &PINE, &PORTE, 0}, // E0 0 {&DDRE, &PINE, &PORTE, 0}, // E0 0
{&DDRE, &PINE, &PORTE, 1}, // E1 1 {&DDRE, &PINE, &PORTE, 1}, // E1 1
{&DDRE, &PINE, &PORTE, 4}, // E4 2 {&DDRE, &PINE, &PORTE, 4}, // E4 2
{&DDRE, &PINE, &PORTE, 5}, // E5 3 {&DDRE, &PINE, &PORTE, 5}, // E5 3
{&DDRG, &PING, &PORTG, 5}, // G5 4 {&DDRG, &PING, &PORTG, 5}, // G5 4
{&DDRE, &PINE, &PORTE, 3}, // E3 5 {&DDRE, &PINE, &PORTE, 3}, // E3 5
{&DDRH, &PINH, &PORTH, 3}, // H3 6 {&DDRH, &PINH, &PORTH, 3}, // H3 6
{&DDRH, &PINH, &PORTH, 4}, // H4 7 {&DDRH, &PINH, &PORTH, 4}, // H4 7
{&DDRH, &PINH, &PORTH, 5}, // H5 8 {&DDRH, &PINH, &PORTH, 5}, // H5 8
{&DDRH, &PINH, &PORTH, 6}, // H6 9 {&DDRH, &PINH, &PORTH, 6}, // H6 9
{&DDRB, &PINB, &PORTB, 4}, // B4 10 {&DDRB, &PINB, &PORTB, 4}, // B4 10
{&DDRB, &PINB, &PORTB, 5}, // B5 11 {&DDRB, &PINB, &PORTB, 5}, // B5 11
{&DDRB, &PINB, &PORTB, 6}, // B6 12 {&DDRB, &PINB, &PORTB, 6}, // B6 12
{&DDRB, &PINB, &PORTB, 7}, // B7 13 {&DDRB, &PINB, &PORTB, 7}, // B7 13
{&DDRJ, &PINJ, &PORTJ, 1}, // J1 14 {&DDRJ, &PINJ, &PORTJ, 1}, // J1 14
{&DDRJ, &PINJ, &PORTJ, 0}, // J0 15 {&DDRJ, &PINJ, &PORTJ, 0}, // J0 15
{&DDRH, &PINH, &PORTH, 1}, // H1 16 {&DDRH, &PINH, &PORTH, 1}, // H1 16
{&DDRH, &PINH, &PORTH, 0}, // H0 17 {&DDRH, &PINH, &PORTH, 0}, // H0 17
{&DDRD, &PIND, &PORTD, 3}, // D3 18 {&DDRD, &PIND, &PORTD, 3}, // D3 18
{&DDRD, &PIND, &PORTD, 2}, // D2 19 {&DDRD, &PIND, &PORTD, 2}, // D2 19
{&DDRD, &PIND, &PORTD, 1}, // D1 20 {&DDRD, &PIND, &PORTD, 1}, // D1 20
{&DDRD, &PIND, &PORTD, 0}, // D0 21 {&DDRD, &PIND, &PORTD, 0}, // D0 21
{&DDRA, &PINA, &PORTA, 0}, // A0 22 {&DDRA, &PINA, &PORTA, 0}, // A0 22
{&DDRA, &PINA, &PORTA, 1}, // A1 23 {&DDRA, &PINA, &PORTA, 1}, // A1 23
{&DDRA, &PINA, &PORTA, 2}, // A2 24 {&DDRA, &PINA, &PORTA, 2}, // A2 24
{&DDRA, &PINA, &PORTA, 3}, // A3 25 {&DDRA, &PINA, &PORTA, 3}, // A3 25
{&DDRA, &PINA, &PORTA, 4}, // A4 26 {&DDRA, &PINA, &PORTA, 4}, // A4 26
{&DDRA, &PINA, &PORTA, 5}, // A5 27 {&DDRA, &PINA, &PORTA, 5}, // A5 27
{&DDRA, &PINA, &PORTA, 6}, // A6 28 {&DDRA, &PINA, &PORTA, 6}, // A6 28
{&DDRA, &PINA, &PORTA, 7}, // A7 29 {&DDRA, &PINA, &PORTA, 7}, // A7 29
{&DDRC, &PINC, &PORTC, 7}, // C7 30 {&DDRC, &PINC, &PORTC, 7}, // C7 30
{&DDRC, &PINC, &PORTC, 6}, // C6 31 {&DDRC, &PINC, &PORTC, 6}, // C6 31
{&DDRC, &PINC, &PORTC, 5}, // C5 32 {&DDRC, &PINC, &PORTC, 5}, // C5 32
{&DDRC, &PINC, &PORTC, 4}, // C4 33 {&DDRC, &PINC, &PORTC, 4}, // C4 33
{&DDRC, &PINC, &PORTC, 3}, // C3 34 {&DDRC, &PINC, &PORTC, 3}, // C3 34
{&DDRC, &PINC, &PORTC, 2}, // C2 35 {&DDRC, &PINC, &PORTC, 2}, // C2 35
{&DDRC, &PINC, &PORTC, 1}, // C1 36 {&DDRC, &PINC, &PORTC, 1}, // C1 36
{&DDRC, &PINC, &PORTC, 0}, // C0 37 {&DDRC, &PINC, &PORTC, 0}, // C0 37
{&DDRD, &PIND, &PORTD, 7}, // D7 38 {&DDRD, &PIND, &PORTD, 7}, // D7 38
{&DDRG, &PING, &PORTG, 2}, // G2 39 {&DDRG, &PING, &PORTG, 2}, // G2 39
{&DDRG, &PING, &PORTG, 1}, // G1 40 {&DDRG, &PING, &PORTG, 1}, // G1 40
{&DDRG, &PING, &PORTG, 0}, // G0 41 {&DDRG, &PING, &PORTG, 0}, // G0 41
{&DDRL, &PINL, &PORTL, 7}, // L7 42 {&DDRL, &PINL, &PORTL, 7}, // L7 42
{&DDRL, &PINL, &PORTL, 6}, // L6 43 {&DDRL, &PINL, &PORTL, 6}, // L6 43
{&DDRL, &PINL, &PORTL, 5}, // L5 44 {&DDRL, &PINL, &PORTL, 5}, // L5 44
{&DDRL, &PINL, &PORTL, 4}, // L4 45 {&DDRL, &PINL, &PORTL, 4}, // L4 45
{&DDRL, &PINL, &PORTL, 3}, // L3 46 {&DDRL, &PINL, &PORTL, 3}, // L3 46
{&DDRL, &PINL, &PORTL, 2}, // L2 47 {&DDRL, &PINL, &PORTL, 2}, // L2 47
{&DDRL, &PINL, &PORTL, 1}, // L1 48 {&DDRL, &PINL, &PORTL, 1}, // L1 48
{&DDRL, &PINL, &PORTL, 0}, // L0 49 {&DDRL, &PINL, &PORTL, 0}, // L0 49
{&DDRB, &PINB, &PORTB, 3}, // B3 50 {&DDRB, &PINB, &PORTB, 3}, // B3 50
{&DDRB, &PINB, &PORTB, 2}, // B2 51 {&DDRB, &PINB, &PORTB, 2}, // B2 51
{&DDRB, &PINB, &PORTB, 1}, // B1 52 {&DDRB, &PINB, &PORTB, 1}, // B1 52
{&DDRB, &PINB, &PORTB, 0}, // B0 53 {&DDRB, &PINB, &PORTB, 0}, // B0 53
{&DDRF, &PINF, &PORTF, 0}, // F0 54 {&DDRF, &PINF, &PORTF, 0}, // F0 54
{&DDRF, &PINF, &PORTF, 1}, // F1 55 {&DDRF, &PINF, &PORTF, 1}, // F1 55
{&DDRF, &PINF, &PORTF, 2}, // F2 56 {&DDRF, &PINF, &PORTF, 2}, // F2 56
{&DDRF, &PINF, &PORTF, 3}, // F3 57 {&DDRF, &PINF, &PORTF, 3}, // F3 57
{&DDRF, &PINF, &PORTF, 4}, // F4 58 {&DDRF, &PINF, &PORTF, 4}, // F4 58
{&DDRF, &PINF, &PORTF, 5}, // F5 59 {&DDRF, &PINF, &PORTF, 5}, // F5 59
{&DDRF, &PINF, &PORTF, 6}, // F6 60 {&DDRF, &PINF, &PORTF, 6}, // F6 60
{&DDRF, &PINF, &PORTF, 7}, // F7 61 {&DDRF, &PINF, &PORTF, 7}, // F7 61
{&DDRK, &PINK, &PORTK, 0}, // K0 62 {&DDRK, &PINK, &PORTK, 0}, // K0 62
{&DDRK, &PINK, &PORTK, 1}, // K1 63 {&DDRK, &PINK, &PORTK, 1}, // K1 63
{&DDRK, &PINK, &PORTK, 2}, // K2 64 {&DDRK, &PINK, &PORTK, 2}, // K2 64
{&DDRK, &PINK, &PORTK, 3}, // K3 65 {&DDRK, &PINK, &PORTK, 3}, // K3 65
{&DDRK, &PINK, &PORTK, 4}, // K4 66 {&DDRK, &PINK, &PORTK, 4}, // K4 66
{&DDRK, &PINK, &PORTK, 5}, // K5 67 {&DDRK, &PINK, &PORTK, 5}, // K5 67
{&DDRK, &PINK, &PORTK, 6}, // K6 68 {&DDRK, &PINK, &PORTK, 6}, // K6 68
{&DDRK, &PINK, &PORTK, 7} // K7 69 {&DDRK, &PINK, &PORTK, 7} // K7 69
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#elif defined(__AVR_ATmega644P__)\ #elif defined(__AVR_ATmega644P__)\
|| defined(__AVR_ATmega644__)\ || defined(__AVR_ATmega644__)\
|| defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284P__)
// Sanguino // Sanguino
// Two Wire (aka I2C) ports // Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 17; // C1 uint8_t const SDA_PIN = 17; // C1
uint8_t const SCL_PIN = 18; // C2 uint8_t const SCL_PIN = 18; // C2
// SPI port // SPI port
uint8_t const SS_PIN = 4; // B4 uint8_t const SS_PIN = 4; // B4
uint8_t const MOSI_PIN = 5; // B5 uint8_t const MOSI_PIN = 5; // B5
uint8_t const MISO_PIN = 6; // B6 uint8_t const MISO_PIN = 6; // B6
uint8_t const SCK_PIN = 7; // B7 uint8_t const SCK_PIN = 7; // B7
static const pin_map_t digitalPinMap[] = { static const pin_map_t digitalPinMap[] = {
{&DDRB, &PINB, &PORTB, 0}, // B0 0 {&DDRB, &PINB, &PORTB, 0}, // B0 0
{&DDRB, &PINB, &PORTB, 1}, // B1 1 {&DDRB, &PINB, &PORTB, 1}, // B1 1
{&DDRB, &PINB, &PORTB, 2}, // B2 2 {&DDRB, &PINB, &PORTB, 2}, // B2 2
{&DDRB, &PINB, &PORTB, 3}, // B3 3 {&DDRB, &PINB, &PORTB, 3}, // B3 3
{&DDRB, &PINB, &PORTB, 4}, // B4 4 {&DDRB, &PINB, &PORTB, 4}, // B4 4
{&DDRB, &PINB, &PORTB, 5}, // B5 5 {&DDRB, &PINB, &PORTB, 5}, // B5 5
{&DDRB, &PINB, &PORTB, 6}, // B6 6 {&DDRB, &PINB, &PORTB, 6}, // B6 6
{&DDRB, &PINB, &PORTB, 7}, // B7 7 {&DDRB, &PINB, &PORTB, 7}, // B7 7
{&DDRD, &PIND, &PORTD, 0}, // D0 8 {&DDRD, &PIND, &PORTD, 0}, // D0 8
{&DDRD, &PIND, &PORTD, 1}, // D1 9 {&DDRD, &PIND, &PORTD, 1}, // D1 9
{&DDRD, &PIND, &PORTD, 2}, // D2 10 {&DDRD, &PIND, &PORTD, 2}, // D2 10
{&DDRD, &PIND, &PORTD, 3}, // D3 11 {&DDRD, &PIND, &PORTD, 3}, // D3 11
{&DDRD, &PIND, &PORTD, 4}, // D4 12 {&DDRD, &PIND, &PORTD, 4}, // D4 12
{&DDRD, &PIND, &PORTD, 5}, // D5 13 {&DDRD, &PIND, &PORTD, 5}, // D5 13
{&DDRD, &PIND, &PORTD, 6}, // D6 14 {&DDRD, &PIND, &PORTD, 6}, // D6 14
{&DDRD, &PIND, &PORTD, 7}, // D7 15 {&DDRD, &PIND, &PORTD, 7}, // D7 15
{&DDRC, &PINC, &PORTC, 0}, // C0 16 {&DDRC, &PINC, &PORTC, 0}, // C0 16
{&DDRC, &PINC, &PORTC, 1}, // C1 17 {&DDRC, &PINC, &PORTC, 1}, // C1 17
{&DDRC, &PINC, &PORTC, 2}, // C2 18 {&DDRC, &PINC, &PORTC, 2}, // C2 18
{&DDRC, &PINC, &PORTC, 3}, // C3 19 {&DDRC, &PINC, &PORTC, 3}, // C3 19
{&DDRC, &PINC, &PORTC, 4}, // C4 20 {&DDRC, &PINC, &PORTC, 4}, // C4 20
{&DDRC, &PINC, &PORTC, 5}, // C5 21 {&DDRC, &PINC, &PORTC, 5}, // C5 21
{&DDRC, &PINC, &PORTC, 6}, // C6 22 {&DDRC, &PINC, &PORTC, 6}, // C6 22
{&DDRC, &PINC, &PORTC, 7}, // C7 23 {&DDRC, &PINC, &PORTC, 7}, // C7 23
{&DDRA, &PINA, &PORTA, 7}, // A7 24 {&DDRA, &PINA, &PORTA, 7}, // A7 24
{&DDRA, &PINA, &PORTA, 6}, // A6 25 {&DDRA, &PINA, &PORTA, 6}, // A6 25
{&DDRA, &PINA, &PORTA, 5}, // A5 26 {&DDRA, &PINA, &PORTA, 5}, // A5 26
{&DDRA, &PINA, &PORTA, 4}, // A4 27 {&DDRA, &PINA, &PORTA, 4}, // A4 27
{&DDRA, &PINA, &PORTA, 3}, // A3 28 {&DDRA, &PINA, &PORTA, 3}, // A3 28
{&DDRA, &PINA, &PORTA, 2}, // A2 29 {&DDRA, &PINA, &PORTA, 2}, // A2 29
{&DDRA, &PINA, &PORTA, 1}, // A1 30 {&DDRA, &PINA, &PORTA, 1}, // A1 30
{&DDRA, &PINA, &PORTA, 0} // A0 31 {&DDRA, &PINA, &PORTA, 0} // A0 31
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#elif defined(__AVR_ATmega32U4__) #elif defined(__AVR_ATmega32U4__)
// Teensy 2.0 // Teensy 2.0
// Two Wire (aka I2C) ports // Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 6; // D1 uint8_t const SDA_PIN = 6; // D1
uint8_t const SCL_PIN = 5; // D0 uint8_t const SCL_PIN = 5; // D0
// SPI port // SPI port
uint8_t const SS_PIN = 0; // B0 uint8_t const SS_PIN = 0; // B0
uint8_t const MOSI_PIN = 2; // B2 uint8_t const MOSI_PIN = 2; // B2
uint8_t const MISO_PIN = 3; // B3 uint8_t const MISO_PIN = 3; // B3
uint8_t const SCK_PIN = 1; // B1 uint8_t const SCK_PIN = 1; // B1
static const pin_map_t digitalPinMap[] = { static const pin_map_t digitalPinMap[] = {
{&DDRB, &PINB, &PORTB, 0}, // B0 0 {&DDRB, &PINB, &PORTB, 0}, // B0 0
{&DDRB, &PINB, &PORTB, 1}, // B1 1 {&DDRB, &PINB, &PORTB, 1}, // B1 1
{&DDRB, &PINB, &PORTB, 2}, // B2 2 {&DDRB, &PINB, &PORTB, 2}, // B2 2
{&DDRB, &PINB, &PORTB, 3}, // B3 3 {&DDRB, &PINB, &PORTB, 3}, // B3 3
{&DDRB, &PINB, &PORTB, 7}, // B7 4 {&DDRB, &PINB, &PORTB, 7}, // B7 4
{&DDRD, &PIND, &PORTD, 0}, // D0 5 {&DDRD, &PIND, &PORTD, 0}, // D0 5
{&DDRD, &PIND, &PORTD, 1}, // D1 6 {&DDRD, &PIND, &PORTD, 1}, // D1 6
{&DDRD, &PIND, &PORTD, 2}, // D2 7 {&DDRD, &PIND, &PORTD, 2}, // D2 7
{&DDRD, &PIND, &PORTD, 3}, // D3 8 {&DDRD, &PIND, &PORTD, 3}, // D3 8
{&DDRC, &PINC, &PORTC, 6}, // C6 9 {&DDRC, &PINC, &PORTC, 6}, // C6 9
{&DDRC, &PINC, &PORTC, 7}, // C7 10 {&DDRC, &PINC, &PORTC, 7}, // C7 10
{&DDRD, &PIND, &PORTD, 6}, // D6 11 {&DDRD, &PIND, &PORTD, 6}, // D6 11
{&DDRD, &PIND, &PORTD, 7}, // D7 12 {&DDRD, &PIND, &PORTD, 7}, // D7 12
{&DDRB, &PINB, &PORTB, 4}, // B4 13 {&DDRB, &PINB, &PORTB, 4}, // B4 13
{&DDRB, &PINB, &PORTB, 5}, // B5 14 {&DDRB, &PINB, &PORTB, 5}, // B5 14
{&DDRB, &PINB, &PORTB, 6}, // B6 15 {&DDRB, &PINB, &PORTB, 6}, // B6 15
{&DDRF, &PINF, &PORTF, 7}, // F7 16 {&DDRF, &PINF, &PORTF, 7}, // F7 16
{&DDRF, &PINF, &PORTF, 6}, // F6 17 {&DDRF, &PINF, &PORTF, 6}, // F6 17
{&DDRF, &PINF, &PORTF, 5}, // F5 18 {&DDRF, &PINF, &PORTF, 5}, // F5 18
{&DDRF, &PINF, &PORTF, 4}, // F4 19 {&DDRF, &PINF, &PORTF, 4}, // F4 19
{&DDRF, &PINF, &PORTF, 1}, // F1 20 {&DDRF, &PINF, &PORTF, 1}, // F1 20
{&DDRF, &PINF, &PORTF, 0}, // F0 21 {&DDRF, &PINF, &PORTF, 0}, // F0 21
{&DDRD, &PIND, &PORTD, 4}, // D4 22 {&DDRD, &PIND, &PORTD, 4}, // D4 22
{&DDRD, &PIND, &PORTD, 5}, // D5 23 {&DDRD, &PIND, &PORTD, 5}, // D5 23
{&DDRE, &PINE, &PORTE, 6} // E6 24 {&DDRE, &PINE, &PORTE, 6} // E6 24
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#elif defined(__AVR_AT90USB646__)\ #elif defined(__AVR_AT90USB646__)\
|| defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286__)
// Teensy++ 1.0 & 2.0 // Teensy++ 1.0 & 2.0
// Two Wire (aka I2C) ports // Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 1; // D1 uint8_t const SDA_PIN = 1; // D1
uint8_t const SCL_PIN = 0; // D0 uint8_t const SCL_PIN = 0; // D0
// SPI port // SPI port
uint8_t const SS_PIN = 20; // B0 uint8_t const SS_PIN = 20; // B0
uint8_t const MOSI_PIN = 22; // B2 uint8_t const MOSI_PIN = 22; // B2
uint8_t const MISO_PIN = 23; // B3 uint8_t const MISO_PIN = 23; // B3
uint8_t const SCK_PIN = 21; // B1 uint8_t const SCK_PIN = 21; // B1
static const pin_map_t digitalPinMap[] = { static const pin_map_t digitalPinMap[] = {
{&DDRD, &PIND, &PORTD, 0}, // D0 0 {&DDRD, &PIND, &PORTD, 0}, // D0 0
{&DDRD, &PIND, &PORTD, 1}, // D1 1 {&DDRD, &PIND, &PORTD, 1}, // D1 1
{&DDRD, &PIND, &PORTD, 2}, // D2 2 {&DDRD, &PIND, &PORTD, 2}, // D2 2
{&DDRD, &PIND, &PORTD, 3}, // D3 3 {&DDRD, &PIND, &PORTD, 3}, // D3 3
{&DDRD, &PIND, &PORTD, 4}, // D4 4 {&DDRD, &PIND, &PORTD, 4}, // D4 4
{&DDRD, &PIND, &PORTD, 5}, // D5 5 {&DDRD, &PIND, &PORTD, 5}, // D5 5
{&DDRD, &PIND, &PORTD, 6}, // D6 6 {&DDRD, &PIND, &PORTD, 6}, // D6 6
{&DDRD, &PIND, &PORTD, 7}, // D7 7 {&DDRD, &PIND, &PORTD, 7}, // D7 7
{&DDRE, &PINE, &PORTE, 0}, // E0 8 {&DDRE, &PINE, &PORTE, 0}, // E0 8
{&DDRE, &PINE, &PORTE, 1}, // E1 9 {&DDRE, &PINE, &PORTE, 1}, // E1 9
{&DDRC, &PINC, &PORTC, 0}, // C0 10 {&DDRC, &PINC, &PORTC, 0}, // C0 10
{&DDRC, &PINC, &PORTC, 1}, // C1 11 {&DDRC, &PINC, &PORTC, 1}, // C1 11
{&DDRC, &PINC, &PORTC, 2}, // C2 12 {&DDRC, &PINC, &PORTC, 2}, // C2 12
{&DDRC, &PINC, &PORTC, 3}, // C3 13 {&DDRC, &PINC, &PORTC, 3}, // C3 13
{&DDRC, &PINC, &PORTC, 4}, // C4 14 {&DDRC, &PINC, &PORTC, 4}, // C4 14
{&DDRC, &PINC, &PORTC, 5}, // C5 15 {&DDRC, &PINC, &PORTC, 5}, // C5 15
{&DDRC, &PINC, &PORTC, 6}, // C6 16 {&DDRC, &PINC, &PORTC, 6}, // C6 16
{&DDRC, &PINC, &PORTC, 7}, // C7 17 {&DDRC, &PINC, &PORTC, 7}, // C7 17
{&DDRE, &PINE, &PORTE, 6}, // E6 18 {&DDRE, &PINE, &PORTE, 6}, // E6 18
{&DDRE, &PINE, &PORTE, 7}, // E7 19 {&DDRE, &PINE, &PORTE, 7}, // E7 19
{&DDRB, &PINB, &PORTB, 0}, // B0 20 {&DDRB, &PINB, &PORTB, 0}, // B0 20
{&DDRB, &PINB, &PORTB, 1}, // B1 21 {&DDRB, &PINB, &PORTB, 1}, // B1 21
{&DDRB, &PINB, &PORTB, 2}, // B2 22 {&DDRB, &PINB, &PORTB, 2}, // B2 22
{&DDRB, &PINB, &PORTB, 3}, // B3 23 {&DDRB, &PINB, &PORTB, 3}, // B3 23
{&DDRB, &PINB, &PORTB, 4}, // B4 24 {&DDRB, &PINB, &PORTB, 4}, // B4 24
{&DDRB, &PINB, &PORTB, 5}, // B5 25 {&DDRB, &PINB, &PORTB, 5}, // B5 25
{&DDRB, &PINB, &PORTB, 6}, // B6 26 {&DDRB, &PINB, &PORTB, 6}, // B6 26
{&DDRB, &PINB, &PORTB, 7}, // B7 27 {&DDRB, &PINB, &PORTB, 7}, // B7 27
{&DDRA, &PINA, &PORTA, 0}, // A0 28 {&DDRA, &PINA, &PORTA, 0}, // A0 28
{&DDRA, &PINA, &PORTA, 1}, // A1 29 {&DDRA, &PINA, &PORTA, 1}, // A1 29
{&DDRA, &PINA, &PORTA, 2}, // A2 30 {&DDRA, &PINA, &PORTA, 2}, // A2 30
{&DDRA, &PINA, &PORTA, 3}, // A3 31 {&DDRA, &PINA, &PORTA, 3}, // A3 31
{&DDRA, &PINA, &PORTA, 4}, // A4 32 {&DDRA, &PINA, &PORTA, 4}, // A4 32
{&DDRA, &PINA, &PORTA, 5}, // A5 33 {&DDRA, &PINA, &PORTA, 5}, // A5 33
{&DDRA, &PINA, &PORTA, 6}, // A6 34 {&DDRA, &PINA, &PORTA, 6}, // A6 34
{&DDRA, &PINA, &PORTA, 7}, // A7 35 {&DDRA, &PINA, &PORTA, 7}, // A7 35
{&DDRE, &PINE, &PORTE, 4}, // E4 36 {&DDRE, &PINE, &PORTE, 4}, // E4 36
{&DDRE, &PINE, &PORTE, 5}, // E5 37 {&DDRE, &PINE, &PORTE, 5}, // E5 37
{&DDRF, &PINF, &PORTF, 0}, // F0 38 {&DDRF, &PINF, &PORTF, 0}, // F0 38
{&DDRF, &PINF, &PORTF, 1}, // F1 39 {&DDRF, &PINF, &PORTF, 1}, // F1 39
{&DDRF, &PINF, &PORTF, 2}, // F2 40 {&DDRF, &PINF, &PORTF, 2}, // F2 40
{&DDRF, &PINF, &PORTF, 3}, // F3 41 {&DDRF, &PINF, &PORTF, 3}, // F3 41
{&DDRF, &PINF, &PORTF, 4}, // F4 42 {&DDRF, &PINF, &PORTF, 4}, // F4 42
{&DDRF, &PINF, &PORTF, 5}, // F5 43 {&DDRF, &PINF, &PORTF, 5}, // F5 43
{&DDRF, &PINF, &PORTF, 6}, // F6 44 {&DDRF, &PINF, &PORTF, 6}, // F6 44
{&DDRF, &PINF, &PORTF, 7} // F7 45 {&DDRF, &PINF, &PORTF, 7} // F7 45
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#elif defined(__AVR_ATmega168__)\ #elif defined(__AVR_ATmega168__)\
||defined(__AVR_ATmega168P__)\ ||defined(__AVR_ATmega168P__)\
||defined(__AVR_ATmega328P__) ||defined(__AVR_ATmega328P__)
// 168 and 328 Arduinos // 168 and 328 Arduinos
// Two Wire (aka I2C) ports // Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 18; // C4 uint8_t const SDA_PIN = 18; // C4
uint8_t const SCL_PIN = 19; // C5 uint8_t const SCL_PIN = 19; // C5
// SPI port // SPI port
uint8_t const SS_PIN = 10; // B2 uint8_t const SS_PIN = 10; // B2
uint8_t const MOSI_PIN = 11; // B3 uint8_t const MOSI_PIN = 11; // B3
uint8_t const MISO_PIN = 12; // B4 uint8_t const MISO_PIN = 12; // B4
uint8_t const SCK_PIN = 13; // B5 uint8_t const SCK_PIN = 13; // B5
static const pin_map_t digitalPinMap[] = { static const pin_map_t digitalPinMap[] = {
{&DDRD, &PIND, &PORTD, 0}, // D0 0 {&DDRD, &PIND, &PORTD, 0}, // D0 0
{&DDRD, &PIND, &PORTD, 1}, // D1 1 {&DDRD, &PIND, &PORTD, 1}, // D1 1
{&DDRD, &PIND, &PORTD, 2}, // D2 2 {&DDRD, &PIND, &PORTD, 2}, // D2 2
{&DDRD, &PIND, &PORTD, 3}, // D3 3 {&DDRD, &PIND, &PORTD, 3}, // D3 3
{&DDRD, &PIND, &PORTD, 4}, // D4 4 {&DDRD, &PIND, &PORTD, 4}, // D4 4
{&DDRD, &PIND, &PORTD, 5}, // D5 5 {&DDRD, &PIND, &PORTD, 5}, // D5 5
{&DDRD, &PIND, &PORTD, 6}, // D6 6 {&DDRD, &PIND, &PORTD, 6}, // D6 6
{&DDRD, &PIND, &PORTD, 7}, // D7 7 {&DDRD, &PIND, &PORTD, 7}, // D7 7
{&DDRB, &PINB, &PORTB, 0}, // B0 8 {&DDRB, &PINB, &PORTB, 0}, // B0 8
{&DDRB, &PINB, &PORTB, 1}, // B1 9 {&DDRB, &PINB, &PORTB, 1}, // B1 9
{&DDRB, &PINB, &PORTB, 2}, // B2 10 {&DDRB, &PINB, &PORTB, 2}, // B2 10
{&DDRB, &PINB, &PORTB, 3}, // B3 11 {&DDRB, &PINB, &PORTB, 3}, // B3 11
{&DDRB, &PINB, &PORTB, 4}, // B4 12 {&DDRB, &PINB, &PORTB, 4}, // B4 12
{&DDRB, &PINB, &PORTB, 5}, // B5 13 {&DDRB, &PINB, &PORTB, 5}, // B5 13
{&DDRC, &PINC, &PORTC, 0}, // C0 14 {&DDRC, &PINC, &PORTC, 0}, // C0 14
{&DDRC, &PINC, &PORTC, 1}, // C1 15 {&DDRC, &PINC, &PORTC, 1}, // C1 15
{&DDRC, &PINC, &PORTC, 2}, // C2 16 {&DDRC, &PINC, &PORTC, 2}, // C2 16
{&DDRC, &PINC, &PORTC, 3}, // C3 17 {&DDRC, &PINC, &PORTC, 3}, // C3 17
{&DDRC, &PINC, &PORTC, 4}, // C4 18 {&DDRC, &PINC, &PORTC, 4}, // C4 18
{&DDRC, &PINC, &PORTC, 5} // C5 19 {&DDRC, &PINC, &PORTC, 5} // C5 19
}; };
#else // defined(__AVR_ATmega1280__) #else // defined(__AVR_ATmega1280__)
#error unknown chip #error unknown chip
#endif // defined(__AVR_ATmega1280__) #endif // defined(__AVR_ATmega1280__)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
static const uint8_t digitalPinCount = sizeof(digitalPinMap)/sizeof(pin_map_t); static const uint8_t digitalPinCount = sizeof(digitalPinMap)/sizeof(pin_map_t);
uint8_t badPinNumber(void) uint8_t badPinNumber(void)
__attribute__((error("Pin number is too large or not a constant"))); __attribute__((error("Pin number is too large or not a constant")));
static inline __attribute__((always_inline)) static inline __attribute__((always_inline))
bool getPinMode(uint8_t pin) { bool getPinMode(uint8_t pin) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) { if (__builtin_constant_p(pin) && pin < digitalPinCount) {
return (*digitalPinMap[pin].ddr >> digitalPinMap[pin].bit) & 1; return (*digitalPinMap[pin].ddr >> digitalPinMap[pin].bit) & 1;
} else { } else {
return badPinNumber(); return badPinNumber();
} }
} }
static inline __attribute__((always_inline)) static inline __attribute__((always_inline))
void setPinMode(uint8_t pin, uint8_t mode) { void setPinMode(uint8_t pin, uint8_t mode) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) { if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (mode) { if (mode) {
*digitalPinMap[pin].ddr |= 1 << digitalPinMap[pin].bit; *digitalPinMap[pin].ddr |= 1 << digitalPinMap[pin].bit;
} else { } else {
*digitalPinMap[pin].ddr &= ~(1 << digitalPinMap[pin].bit); *digitalPinMap[pin].ddr &= ~(1 << digitalPinMap[pin].bit);
} }
} else { } else {
badPinNumber(); badPinNumber();
} }
} }
static inline __attribute__((always_inline)) static inline __attribute__((always_inline))
bool fastDigitalRead(uint8_t pin) { bool fastDigitalRead(uint8_t pin) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) { if (__builtin_constant_p(pin) && pin < digitalPinCount) {
return (*digitalPinMap[pin].pin >> digitalPinMap[pin].bit) & 1; return (*digitalPinMap[pin].pin >> digitalPinMap[pin].bit) & 1;
} else { } else {
return badPinNumber(); return badPinNumber();
} }
} }
static inline __attribute__((always_inline)) static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, uint8_t value) { void fastDigitalWrite(uint8_t pin, uint8_t value) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) { if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (value) { if (value) {
*digitalPinMap[pin].port |= 1 << digitalPinMap[pin].bit; *digitalPinMap[pin].port |= 1 << digitalPinMap[pin].bit;
} else { } else {
*digitalPinMap[pin].port &= ~(1 << digitalPinMap[pin].bit); *digitalPinMap[pin].port &= ~(1 << digitalPinMap[pin].bit);
} }
} else { } else {
badPinNumber(); badPinNumber();
} }
} }
#endif // Sd2PinMap_h #endif // Sd2PinMap_h
#endif #endif

View File

@ -1,51 +1,51 @@
/* Arduino SdFat Library /* Arduino SdFat Library
* Copyright (C) 2008 by William Greiman * Copyright (C) 2008 by William Greiman
* *
* This file is part of the Arduino SdFat Library * This file is part of the Arduino SdFat Library
* *
* This Library is free software: you can redistribute it and/or modify * This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This Library is distributed in the hope that it will be useful, * This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h" #include "Marlin.h"
#ifdef SDSUPPORT #ifdef SDSUPPORT
#ifndef SdFatUtil_h #ifndef SdFatUtil_h
#define SdFatUtil_h #define SdFatUtil_h
/** /**
* \file * \file
* \brief Useful utility functions. * \brief Useful utility functions.
*/ */
#include "Marlin.h" #include "Marlin.h"
#include "MarlinSerial.h" #include "MarlinSerial.h"
/** Store and print a string in flash memory.*/ /** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x)) #define PgmPrint(x) SerialPrint_P(PSTR(x))
/** Store and print a string in flash memory followed by a CR/LF.*/ /** Store and print a string in flash memory followed by a CR/LF.*/
#define PgmPrintln(x) SerialPrintln_P(PSTR(x)) #define PgmPrintln(x) SerialPrintln_P(PSTR(x))
namespace SdFatUtil { namespace SdFatUtil {
int FreeRam(); int FreeRam();
void print_P( PGM_P str); void print_P( PGM_P str);
void println_P( PGM_P str); void println_P( PGM_P str);
void SerialPrint_P(PGM_P str); void SerialPrint_P(PGM_P str);
void SerialPrintln_P(PGM_P str); void SerialPrintln_P(PGM_P str);
void set_stack_guard(); void set_stack_guard();
bool test_stack_integrity(); bool test_stack_integrity();
uint32_t get_stack_guard_test_value(); uint32_t get_stack_guard_test_value();
} }
using namespace SdFatUtil; // NOLINT using namespace SdFatUtil; // NOLINT
#endif // #define SdFatUtil_h #endif // #define SdFatUtil_h
#endif #endif

View File

@ -1,95 +1,95 @@
/* Arduino SdFat Library /* Arduino SdFat Library
* Copyright (C) 2009 by William Greiman * Copyright (C) 2009 by William Greiman
* *
* This file is part of the Arduino SdFat Library * This file is part of the Arduino SdFat Library
* *
* This Library is free software: you can redistribute it and/or modify * This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This Library is distributed in the hope that it will be useful, * This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h" #include "Marlin.h"
#ifdef SDSUPPORT #ifdef SDSUPPORT
#include "SdFile.h" #include "SdFile.h"
/** Create a file object and open it in the current working directory. /** Create a file object and open it in the current working directory.
* *
* \param[in] path A path with a valid 8.3 DOS name for a file to be opened. * \param[in] path A path with a valid 8.3 DOS name for a file to be opened.
* *
* \param[in] oflag Values for \a oflag are constructed by a bitwise-inclusive * \param[in] oflag Values for \a oflag are constructed by a bitwise-inclusive
* OR of open flags. see SdBaseFile::open(SdBaseFile*, const char*, uint8_t). * OR of open flags. see SdBaseFile::open(SdBaseFile*, const char*, uint8_t).
*/ */
SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) { SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Write data to an open file. /** Write data to an open file.
* *
* \note Data is moved to the cache but may not be written to the * \note Data is moved to the cache but may not be written to the
* storage device until sync() is called. * storage device until sync() is called.
* *
* \param[in] buf Pointer to the location of the data to be written. * \param[in] buf Pointer to the location of the data to be written.
* *
* \param[in] nbyte Number of bytes to write. * \param[in] nbyte Number of bytes to write.
* *
* \return For success write() returns the number of bytes written, always * \return For success write() returns the number of bytes written, always
* \a nbyte. If an error occurs, write() returns -1. Possible errors * \a nbyte. If an error occurs, write() returns -1. Possible errors
* include write() is called before a file has been opened, write is called * include write() is called before a file has been opened, write is called
* for a read-only file, device is full, a corrupt file system or an I/O error. * for a read-only file, device is full, a corrupt file system or an I/O error.
* *
*/ */
int16_t SdFile::write(const void* buf, uint16_t nbyte) { int16_t SdFile::write(const void* buf, uint16_t nbyte) {
return SdBaseFile::write(buf, nbyte); return SdBaseFile::write(buf, nbyte);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Write a byte to a file. Required by the Arduino Print class. /** Write a byte to a file. Required by the Arduino Print class.
* \param[in] b the byte to be written. * \param[in] b the byte to be written.
* Use writeError to check for errors. * Use writeError to check for errors.
*/ */
#if ARDUINO >= 100 #if ARDUINO >= 100
size_t SdFile::write(uint8_t b) size_t SdFile::write(uint8_t b)
{ {
return SdBaseFile::write(&b, 1); return SdBaseFile::write(&b, 1);
} }
#else #else
void SdFile::write(uint8_t b) void SdFile::write(uint8_t b)
{ {
SdBaseFile::write(&b, 1); SdBaseFile::write(&b, 1);
} }
#endif #endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Write a string to a file. Used by the Arduino Print class. /** Write a string to a file. Used by the Arduino Print class.
* \param[in] str Pointer to the string. * \param[in] str Pointer to the string.
* Use writeError to check for errors. * Use writeError to check for errors.
*/ */
void SdFile::write(const char* str) { void SdFile::write(const char* str) {
SdBaseFile::write(str, strlen(str)); SdBaseFile::write(str, strlen(str));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Write a PROGMEM string to a file. /** Write a PROGMEM string to a file.
* \param[in] str Pointer to the PROGMEM string. * \param[in] str Pointer to the PROGMEM string.
* Use writeError to check for errors. * Use writeError to check for errors.
*/ */
void SdFile::write_P(PGM_P str) { void SdFile::write_P(PGM_P str) {
for (uint8_t c; (c = pgm_read_byte(str)); str++) write(c); for (uint8_t c; (c = pgm_read_byte(str)); str++) write(c);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Write a PROGMEM string followed by CR/LF to a file. /** Write a PROGMEM string followed by CR/LF to a file.
* \param[in] str Pointer to the PROGMEM string. * \param[in] str Pointer to the PROGMEM string.
* Use writeError to check for errors. * Use writeError to check for errors.
*/ */
void SdFile::writeln_P(PGM_P str) { void SdFile::writeln_P(PGM_P str) {
write_P(str); write_P(str);
write_P(PSTR("\r\n")); write_P(PSTR("\r\n"));
} }
#endif #endif

View File

@ -1,286 +1,286 @@
/* Arduino Sd2Card Library /* Arduino Sd2Card Library
* Copyright (C) 2009 by William Greiman * Copyright (C) 2009 by William Greiman
* *
* This file is part of the Arduino Sd2Card Library * This file is part of the Arduino Sd2Card Library
* *
* This Library is free software: you can redistribute it and/or modify * This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This Library is distributed in the hope that it will be useful, * This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the Arduino Sd2Card Library. If not, see * along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h" #include "Marlin.h"
#ifdef SDSUPPORT #ifdef SDSUPPORT
#ifndef SdInfo_h #ifndef SdInfo_h
#define SdInfo_h #define SdInfo_h
#include <stdint.h> #include <stdint.h>
// Based on the document: // Based on the document:
// //
// SD Specifications // SD Specifications
// Part 1 // Part 1
// Physical Layer // Physical Layer
// Simplified Specification // Simplified Specification
// Version 3.01 // Version 3.01
// May 18, 2010 // May 18, 2010
// //
// http://www.sdcard.org/developers/tech/sdcard/pls/simplified_specs // http://www.sdcard.org/developers/tech/sdcard/pls/simplified_specs
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// SD card commands // SD card commands
/** GO_IDLE_STATE - init card in spi mode if CS low */ /** GO_IDLE_STATE - init card in spi mode if CS low */
uint8_t const CMD0 = 0X00; uint8_t const CMD0 = 0X00;
/** SEND_IF_COND - verify SD Memory Card interface operating condition.*/ /** SEND_IF_COND - verify SD Memory Card interface operating condition.*/
uint8_t const CMD8 = 0X08; uint8_t const CMD8 = 0X08;
/** SEND_CSD - read the Card Specific Data (CSD register) */ /** SEND_CSD - read the Card Specific Data (CSD register) */
uint8_t const CMD9 = 0X09; uint8_t const CMD9 = 0X09;
/** SEND_CID - read the card identification information (CID register) */ /** SEND_CID - read the card identification information (CID register) */
uint8_t const CMD10 = 0X0A; uint8_t const CMD10 = 0X0A;
/** STOP_TRANSMISSION - end multiple block read sequence */ /** STOP_TRANSMISSION - end multiple block read sequence */
uint8_t const CMD12 = 0X0C; uint8_t const CMD12 = 0X0C;
/** SEND_STATUS - read the card status register */ /** SEND_STATUS - read the card status register */
uint8_t const CMD13 = 0X0D; uint8_t const CMD13 = 0X0D;
/** READ_SINGLE_BLOCK - read a single data block from the card */ /** READ_SINGLE_BLOCK - read a single data block from the card */
uint8_t const CMD17 = 0X11; uint8_t const CMD17 = 0X11;
/** READ_MULTIPLE_BLOCK - read a multiple data blocks from the card */ /** READ_MULTIPLE_BLOCK - read a multiple data blocks from the card */
uint8_t const CMD18 = 0X12; uint8_t const CMD18 = 0X12;
/** WRITE_BLOCK - write a single data block to the card */ /** WRITE_BLOCK - write a single data block to the card */
uint8_t const CMD24 = 0X18; uint8_t const CMD24 = 0X18;
/** WRITE_MULTIPLE_BLOCK - write blocks of data until a STOP_TRANSMISSION */ /** WRITE_MULTIPLE_BLOCK - write blocks of data until a STOP_TRANSMISSION */
uint8_t const CMD25 = 0X19; uint8_t const CMD25 = 0X19;
/** ERASE_WR_BLK_START - sets the address of the first block to be erased */ /** ERASE_WR_BLK_START - sets the address of the first block to be erased */
uint8_t const CMD32 = 0X20; uint8_t const CMD32 = 0X20;
/** ERASE_WR_BLK_END - sets the address of the last block of the continuous /** ERASE_WR_BLK_END - sets the address of the last block of the continuous
range to be erased*/ range to be erased*/
uint8_t const CMD33 = 0X21; uint8_t const CMD33 = 0X21;
/** ERASE - erase all previously selected blocks */ /** ERASE - erase all previously selected blocks */
uint8_t const CMD38 = 0X26; uint8_t const CMD38 = 0X26;
/** Toshiba FlashAir: iSDIO */ /** Toshiba FlashAir: iSDIO */
uint8_t const CMD48 = 0x30; uint8_t const CMD48 = 0x30;
/** Toshiba FlashAir: iSDIO */ /** Toshiba FlashAir: iSDIO */
uint8_t const CMD49 = 0x31; uint8_t const CMD49 = 0x31;
/** APP_CMD - escape for application specific command */ /** APP_CMD - escape for application specific command */
uint8_t const CMD55 = 0X37; uint8_t const CMD55 = 0X37;
/** READ_OCR - read the OCR register of a card */ /** READ_OCR - read the OCR register of a card */
uint8_t const CMD58 = 0X3A; uint8_t const CMD58 = 0X3A;
/** SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be /** SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be
pre-erased before writing */ pre-erased before writing */
uint8_t const ACMD23 = 0X17; uint8_t const ACMD23 = 0X17;
/** SD_SEND_OP_COMD - Sends host capacity support information and /** SD_SEND_OP_COMD - Sends host capacity support information and
activates the card's initialization process */ activates the card's initialization process */
uint8_t const ACMD41 = 0X29; uint8_t const ACMD41 = 0X29;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** status for card in the ready state */ /** status for card in the ready state */
uint8_t const R1_READY_STATE = 0X00; uint8_t const R1_READY_STATE = 0X00;
/** status for card in the idle state */ /** status for card in the idle state */
uint8_t const R1_IDLE_STATE = 0X01; uint8_t const R1_IDLE_STATE = 0X01;
/** status bit for illegal command */ /** status bit for illegal command */
uint8_t const R1_ILLEGAL_COMMAND = 0X04; uint8_t const R1_ILLEGAL_COMMAND = 0X04;
/** start data token for read or write single block*/ /** start data token for read or write single block*/
uint8_t const DATA_START_BLOCK = 0XFE; uint8_t const DATA_START_BLOCK = 0XFE;
/** stop token for write multiple blocks*/ /** stop token for write multiple blocks*/
uint8_t const STOP_TRAN_TOKEN = 0XFD; uint8_t const STOP_TRAN_TOKEN = 0XFD;
/** start data token for write multiple blocks*/ /** start data token for write multiple blocks*/
uint8_t const WRITE_MULTIPLE_TOKEN = 0XFC; uint8_t const WRITE_MULTIPLE_TOKEN = 0XFC;
/** mask for data response tokens after a write block operation */ /** mask for data response tokens after a write block operation */
uint8_t const DATA_RES_MASK = 0X1F; uint8_t const DATA_RES_MASK = 0X1F;
/** write data accepted token */ /** write data accepted token */
uint8_t const DATA_RES_ACCEPTED = 0X05; uint8_t const DATA_RES_ACCEPTED = 0X05;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Card IDentification (CID) register */ /** Card IDentification (CID) register */
typedef struct CID { typedef struct CID {
// byte 0 // byte 0
/** Manufacturer ID */ /** Manufacturer ID */
unsigned char mid; unsigned char mid;
// byte 1-2 // byte 1-2
/** OEM/Application ID */ /** OEM/Application ID */
char oid[2]; char oid[2];
// byte 3-7 // byte 3-7
/** Product name */ /** Product name */
char pnm[5]; char pnm[5];
// byte 8 // byte 8
/** Product revision least significant digit */ /** Product revision least significant digit */
unsigned char prv_m : 4; unsigned char prv_m : 4;
/** Product revision most significant digit */ /** Product revision most significant digit */
unsigned char prv_n : 4; unsigned char prv_n : 4;
// byte 9-12 // byte 9-12
/** Product serial number */ /** Product serial number */
uint32_t psn; uint32_t psn;
// byte 13 // byte 13
/** Manufacturing date year low digit */ /** Manufacturing date year low digit */
unsigned char mdt_year_high : 4; unsigned char mdt_year_high : 4;
/** not used */ /** not used */
unsigned char reserved : 4; unsigned char reserved : 4;
// byte 14 // byte 14
/** Manufacturing date month */ /** Manufacturing date month */
unsigned char mdt_month : 4; unsigned char mdt_month : 4;
/** Manufacturing date year low digit */ /** Manufacturing date year low digit */
unsigned char mdt_year_low :4; unsigned char mdt_year_low :4;
// byte 15 // byte 15
/** not used always 1 */ /** not used always 1 */
unsigned char always1 : 1; unsigned char always1 : 1;
/** CRC7 checksum */ /** CRC7 checksum */
unsigned char crc : 7; unsigned char crc : 7;
}cid_t; }cid_t;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** CSD for version 1.00 cards */ /** CSD for version 1.00 cards */
typedef struct CSDV1 { typedef struct CSDV1 {
// byte 0 // byte 0
unsigned char reserved1 : 6; unsigned char reserved1 : 6;
unsigned char csd_ver : 2; unsigned char csd_ver : 2;
// byte 1 // byte 1
unsigned char taac; unsigned char taac;
// byte 2 // byte 2
unsigned char nsac; unsigned char nsac;
// byte 3 // byte 3
unsigned char tran_speed; unsigned char tran_speed;
// byte 4 // byte 4
unsigned char ccc_high; unsigned char ccc_high;
// byte 5 // byte 5
unsigned char read_bl_len : 4; unsigned char read_bl_len : 4;
unsigned char ccc_low : 4; unsigned char ccc_low : 4;
// byte 6 // byte 6
unsigned char c_size_high : 2; unsigned char c_size_high : 2;
unsigned char reserved2 : 2; unsigned char reserved2 : 2;
unsigned char dsr_imp : 1; unsigned char dsr_imp : 1;
unsigned char read_blk_misalign :1; unsigned char read_blk_misalign :1;
unsigned char write_blk_misalign : 1; unsigned char write_blk_misalign : 1;
unsigned char read_bl_partial : 1; unsigned char read_bl_partial : 1;
// byte 7 // byte 7
unsigned char c_size_mid; unsigned char c_size_mid;
// byte 8 // byte 8
unsigned char vdd_r_curr_max : 3; unsigned char vdd_r_curr_max : 3;
unsigned char vdd_r_curr_min : 3; unsigned char vdd_r_curr_min : 3;
unsigned char c_size_low :2; unsigned char c_size_low :2;
// byte 9 // byte 9
unsigned char c_size_mult_high : 2; unsigned char c_size_mult_high : 2;
unsigned char vdd_w_cur_max : 3; unsigned char vdd_w_cur_max : 3;
unsigned char vdd_w_curr_min : 3; unsigned char vdd_w_curr_min : 3;
// byte 10 // byte 10
unsigned char sector_size_high : 6; unsigned char sector_size_high : 6;
unsigned char erase_blk_en : 1; unsigned char erase_blk_en : 1;
unsigned char c_size_mult_low : 1; unsigned char c_size_mult_low : 1;
// byte 11 // byte 11
unsigned char wp_grp_size : 7; unsigned char wp_grp_size : 7;
unsigned char sector_size_low : 1; unsigned char sector_size_low : 1;
// byte 12 // byte 12
unsigned char write_bl_len_high : 2; unsigned char write_bl_len_high : 2;
unsigned char r2w_factor : 3; unsigned char r2w_factor : 3;
unsigned char reserved3 : 2; unsigned char reserved3 : 2;
unsigned char wp_grp_enable : 1; unsigned char wp_grp_enable : 1;
// byte 13 // byte 13
unsigned char reserved4 : 5; unsigned char reserved4 : 5;
unsigned char write_partial : 1; unsigned char write_partial : 1;
unsigned char write_bl_len_low : 2; unsigned char write_bl_len_low : 2;
// byte 14 // byte 14
unsigned char reserved5: 2; unsigned char reserved5: 2;
unsigned char file_format : 2; unsigned char file_format : 2;
unsigned char tmp_write_protect : 1; unsigned char tmp_write_protect : 1;
unsigned char perm_write_protect : 1; unsigned char perm_write_protect : 1;
unsigned char copy : 1; unsigned char copy : 1;
/** Indicates the file format on the card */ /** Indicates the file format on the card */
unsigned char file_format_grp : 1; unsigned char file_format_grp : 1;
// byte 15 // byte 15
unsigned char always1 : 1; unsigned char always1 : 1;
unsigned char crc : 7; unsigned char crc : 7;
}csd1_t; }csd1_t;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** CSD for version 2.00 cards */ /** CSD for version 2.00 cards */
typedef struct CSDV2 { typedef struct CSDV2 {
// byte 0 // byte 0
unsigned char reserved1 : 6; unsigned char reserved1 : 6;
unsigned char csd_ver : 2; unsigned char csd_ver : 2;
// byte 1 // byte 1
/** fixed to 0X0E */ /** fixed to 0X0E */
unsigned char taac; unsigned char taac;
// byte 2 // byte 2
/** fixed to 0 */ /** fixed to 0 */
unsigned char nsac; unsigned char nsac;
// byte 3 // byte 3
unsigned char tran_speed; unsigned char tran_speed;
// byte 4 // byte 4
unsigned char ccc_high; unsigned char ccc_high;
// byte 5 // byte 5
/** This field is fixed to 9h, which indicates READ_BL_LEN=512 Byte */ /** This field is fixed to 9h, which indicates READ_BL_LEN=512 Byte */
unsigned char read_bl_len : 4; unsigned char read_bl_len : 4;
unsigned char ccc_low : 4; unsigned char ccc_low : 4;
// byte 6 // byte 6
/** not used */ /** not used */
unsigned char reserved2 : 4; unsigned char reserved2 : 4;
unsigned char dsr_imp : 1; unsigned char dsr_imp : 1;
/** fixed to 0 */ /** fixed to 0 */
unsigned char read_blk_misalign :1; unsigned char read_blk_misalign :1;
/** fixed to 0 */ /** fixed to 0 */
unsigned char write_blk_misalign : 1; unsigned char write_blk_misalign : 1;
/** fixed to 0 - no partial read */ /** fixed to 0 - no partial read */
unsigned char read_bl_partial : 1; unsigned char read_bl_partial : 1;
// byte 7 // byte 7
/** not used */ /** not used */
unsigned char reserved3 : 2; unsigned char reserved3 : 2;
/** high part of card size */ /** high part of card size */
unsigned char c_size_high : 6; unsigned char c_size_high : 6;
// byte 8 // byte 8
/** middle part of card size */ /** middle part of card size */
unsigned char c_size_mid; unsigned char c_size_mid;
// byte 9 // byte 9
/** low part of card size */ /** low part of card size */
unsigned char c_size_low; unsigned char c_size_low;
// byte 10 // byte 10
/** sector size is fixed at 64 KB */ /** sector size is fixed at 64 KB */
unsigned char sector_size_high : 6; unsigned char sector_size_high : 6;
/** fixed to 1 - erase single is supported */ /** fixed to 1 - erase single is supported */
unsigned char erase_blk_en : 1; unsigned char erase_blk_en : 1;
/** not used */ /** not used */
unsigned char reserved4 : 1; unsigned char reserved4 : 1;
// byte 11 // byte 11
unsigned char wp_grp_size : 7; unsigned char wp_grp_size : 7;
/** sector size is fixed at 64 KB */ /** sector size is fixed at 64 KB */
unsigned char sector_size_low : 1; unsigned char sector_size_low : 1;
// byte 12 // byte 12
/** write_bl_len fixed for 512 byte blocks */ /** write_bl_len fixed for 512 byte blocks */
unsigned char write_bl_len_high : 2; unsigned char write_bl_len_high : 2;
/** fixed value of 2 */ /** fixed value of 2 */
unsigned char r2w_factor : 3; unsigned char r2w_factor : 3;
/** not used */ /** not used */
unsigned char reserved5 : 2; unsigned char reserved5 : 2;
/** fixed value of 0 - no write protect groups */ /** fixed value of 0 - no write protect groups */
unsigned char wp_grp_enable : 1; unsigned char wp_grp_enable : 1;
// byte 13 // byte 13
unsigned char reserved6 : 5; unsigned char reserved6 : 5;
/** always zero - no partial block read*/ /** always zero - no partial block read*/
unsigned char write_partial : 1; unsigned char write_partial : 1;
/** write_bl_len fixed for 512 byte blocks */ /** write_bl_len fixed for 512 byte blocks */
unsigned char write_bl_len_low : 2; unsigned char write_bl_len_low : 2;
// byte 14 // byte 14
unsigned char reserved7: 2; unsigned char reserved7: 2;
/** Do not use always 0 */ /** Do not use always 0 */
unsigned char file_format : 2; unsigned char file_format : 2;
unsigned char tmp_write_protect : 1; unsigned char tmp_write_protect : 1;
unsigned char perm_write_protect : 1; unsigned char perm_write_protect : 1;
unsigned char copy : 1; unsigned char copy : 1;
/** Do not use always 0 */ /** Do not use always 0 */
unsigned char file_format_grp : 1; unsigned char file_format_grp : 1;
// byte 15 // byte 15
/** not used always 1 */ /** not used always 1 */
unsigned char always1 : 1; unsigned char always1 : 1;
/** checksum */ /** checksum */
unsigned char crc : 7; unsigned char crc : 7;
}csd2_t; }csd2_t;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** union of old and new style CSD register */ /** union of old and new style CSD register */
union csd_t { union csd_t {
csd1_t v1; csd1_t v1;
csd2_t v2; csd2_t v2;
}; };
#endif // SdInfo_h #endif // SdInfo_h
#endif #endif

View File

@ -1,405 +1,405 @@
/* Arduino SdFat Library /* Arduino SdFat Library
* Copyright (C) 2009 by William Greiman * Copyright (C) 2009 by William Greiman
* *
* This file is part of the Arduino SdFat Library * This file is part of the Arduino SdFat Library
* *
* This Library is free software: you can redistribute it and/or modify * This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This Library is distributed in the hope that it will be useful, * This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h" #include "Marlin.h"
#ifdef SDSUPPORT #ifdef SDSUPPORT
#include "SdVolume.h" #include "SdVolume.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if !USE_MULTIPLE_CARDS #if !USE_MULTIPLE_CARDS
// raw block cache // raw block cache
uint32_t SdVolume::cacheBlockNumber_; // current block number uint32_t SdVolume::cacheBlockNumber_; // current block number
cache_t SdVolume::cacheBuffer_; // 512 byte cache for Sd2Card cache_t SdVolume::cacheBuffer_; // 512 byte cache for Sd2Card
Sd2Card* SdVolume::sdCard_; // pointer to SD card object Sd2Card* SdVolume::sdCard_; // pointer to SD card object
bool SdVolume::cacheDirty_; // cacheFlush() will write block if true bool SdVolume::cacheDirty_; // cacheFlush() will write block if true
uint32_t SdVolume::cacheMirrorBlock_; // mirror block for second FAT uint32_t SdVolume::cacheMirrorBlock_; // mirror block for second FAT
#endif // USE_MULTIPLE_CARDS #endif // USE_MULTIPLE_CARDS
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// find a contiguous group of clusters // find a contiguous group of clusters
bool SdVolume::allocContiguous(uint32_t count, uint32_t* curCluster) { bool SdVolume::allocContiguous(uint32_t count, uint32_t* curCluster) {
// start of group // start of group
uint32_t bgnCluster; uint32_t bgnCluster;
// end of group // end of group
uint32_t endCluster; uint32_t endCluster;
// last cluster of FAT // last cluster of FAT
uint32_t fatEnd = clusterCount_ + 1; uint32_t fatEnd = clusterCount_ + 1;
// flag to save place to start next search // flag to save place to start next search
bool setStart; bool setStart;
// set search start cluster // set search start cluster
if (*curCluster) { if (*curCluster) {
// try to make file contiguous // try to make file contiguous
bgnCluster = *curCluster + 1; bgnCluster = *curCluster + 1;
// don't save new start location // don't save new start location
setStart = false; setStart = false;
} else { } else {
// start at likely place for free cluster // start at likely place for free cluster
bgnCluster = allocSearchStart_; bgnCluster = allocSearchStart_;
// save next search start if one cluster // save next search start if one cluster
setStart = count == 1; setStart = count == 1;
} }
// end of group // end of group
endCluster = bgnCluster; endCluster = bgnCluster;
// search the FAT for free clusters // search the FAT for free clusters
for (uint32_t n = 0;; n++, endCluster++) { for (uint32_t n = 0;; n++, endCluster++) {
// can't find space checked all clusters // can't find space checked all clusters
if (n >= clusterCount_) goto fail; if (n >= clusterCount_) goto fail;
// past end - start from beginning of FAT // past end - start from beginning of FAT
if (endCluster > fatEnd) { if (endCluster > fatEnd) {
bgnCluster = endCluster = 2; bgnCluster = endCluster = 2;
} }
uint32_t f; uint32_t f;
if (!fatGet(endCluster, &f)) goto fail; if (!fatGet(endCluster, &f)) goto fail;
if (f != 0) { if (f != 0) {
// cluster in use try next cluster as bgnCluster // cluster in use try next cluster as bgnCluster
bgnCluster = endCluster + 1; bgnCluster = endCluster + 1;
} else if ((endCluster - bgnCluster + 1) == count) { } else if ((endCluster - bgnCluster + 1) == count) {
// done - found space // done - found space
break; break;
} }
} }
// mark end of chain // mark end of chain
if (!fatPutEOC(endCluster)) goto fail; if (!fatPutEOC(endCluster)) goto fail;
// link clusters // link clusters
while (endCluster > bgnCluster) { while (endCluster > bgnCluster) {
if (!fatPut(endCluster - 1, endCluster)) goto fail; if (!fatPut(endCluster - 1, endCluster)) goto fail;
endCluster--; endCluster--;
} }
if (*curCluster != 0) { if (*curCluster != 0) {
// connect chains // connect chains
if (!fatPut(*curCluster, bgnCluster)) goto fail; if (!fatPut(*curCluster, bgnCluster)) goto fail;
} }
// return first cluster number to caller // return first cluster number to caller
*curCluster = bgnCluster; *curCluster = bgnCluster;
// remember possible next free cluster // remember possible next free cluster
if (setStart) allocSearchStart_ = bgnCluster + 1; if (setStart) allocSearchStart_ = bgnCluster + 1;
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SdVolume::cacheFlush() { bool SdVolume::cacheFlush() {
if (cacheDirty_) { if (cacheDirty_) {
if (!sdCard_->writeBlock(cacheBlockNumber_, cacheBuffer_.data)) { if (!sdCard_->writeBlock(cacheBlockNumber_, cacheBuffer_.data)) {
goto fail; goto fail;
} }
// mirror FAT tables // mirror FAT tables
if (cacheMirrorBlock_) { if (cacheMirrorBlock_) {
if (!sdCard_->writeBlock(cacheMirrorBlock_, cacheBuffer_.data)) { if (!sdCard_->writeBlock(cacheMirrorBlock_, cacheBuffer_.data)) {
goto fail; goto fail;
} }
cacheMirrorBlock_ = 0; cacheMirrorBlock_ = 0;
} }
cacheDirty_ = 0; cacheDirty_ = 0;
} }
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SdVolume::cacheRawBlock(uint32_t blockNumber, bool dirty) { bool SdVolume::cacheRawBlock(uint32_t blockNumber, bool dirty) {
if (cacheBlockNumber_ != blockNumber) { if (cacheBlockNumber_ != blockNumber) {
if (!cacheFlush()) goto fail; if (!cacheFlush()) goto fail;
if (!sdCard_->readBlock(blockNumber, cacheBuffer_.data)) goto fail; if (!sdCard_->readBlock(blockNumber, cacheBuffer_.data)) goto fail;
cacheBlockNumber_ = blockNumber; cacheBlockNumber_ = blockNumber;
} }
if (dirty) cacheDirty_ = true; if (dirty) cacheDirty_ = true;
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// return the size in bytes of a cluster chain // return the size in bytes of a cluster chain
bool SdVolume::chainSize(uint32_t cluster, uint32_t* size) { bool SdVolume::chainSize(uint32_t cluster, uint32_t* size) {
uint32_t s = 0; uint32_t s = 0;
do { do {
if (!fatGet(cluster, &cluster)) goto fail; if (!fatGet(cluster, &cluster)) goto fail;
s += 512UL << clusterSizeShift_; s += 512UL << clusterSizeShift_;
} while (!isEOC(cluster)); } while (!isEOC(cluster));
*size = s; *size = s;
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Fetch a FAT entry // Fetch a FAT entry
bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) { bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
uint32_t lba; uint32_t lba;
if (cluster > (clusterCount_ + 1)) goto fail; if (cluster > (clusterCount_ + 1)) goto fail;
if (FAT12_SUPPORT && fatType_ == 12) { if (FAT12_SUPPORT && fatType_ == 12) {
uint16_t index = cluster; uint16_t index = cluster;
index += index >> 1; index += index >> 1;
lba = fatStartBlock_ + (index >> 9); lba = fatStartBlock_ + (index >> 9);
if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail; if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail;
index &= 0X1FF; index &= 0X1FF;
uint16_t tmp = cacheBuffer_.data[index]; uint16_t tmp = cacheBuffer_.data[index];
index++; index++;
if (index == 512) { if (index == 512) {
if (!cacheRawBlock(lba + 1, CACHE_FOR_READ)) goto fail; if (!cacheRawBlock(lba + 1, CACHE_FOR_READ)) goto fail;
index = 0; index = 0;
} }
tmp |= cacheBuffer_.data[index] << 8; tmp |= cacheBuffer_.data[index] << 8;
*value = cluster & 1 ? tmp >> 4 : tmp & 0XFFF; *value = cluster & 1 ? tmp >> 4 : tmp & 0XFFF;
return true; return true;
} }
if (fatType_ == 16) { if (fatType_ == 16) {
lba = fatStartBlock_ + (cluster >> 8); lba = fatStartBlock_ + (cluster >> 8);
} else if (fatType_ == 32) { } else if (fatType_ == 32) {
lba = fatStartBlock_ + (cluster >> 7); lba = fatStartBlock_ + (cluster >> 7);
} else { } else {
goto fail; goto fail;
} }
if (lba != cacheBlockNumber_) { if (lba != cacheBlockNumber_) {
if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail; if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail;
} }
if (fatType_ == 16) { if (fatType_ == 16) {
*value = cacheBuffer_.fat16[cluster & 0XFF]; *value = cacheBuffer_.fat16[cluster & 0XFF];
} else { } else {
*value = cacheBuffer_.fat32[cluster & 0X7F] & FAT32MASK; *value = cacheBuffer_.fat32[cluster & 0X7F] & FAT32MASK;
} }
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Store a FAT entry // Store a FAT entry
bool SdVolume::fatPut(uint32_t cluster, uint32_t value) { bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
uint32_t lba; uint32_t lba;
// error if reserved cluster // error if reserved cluster
if (cluster < 2) goto fail; if (cluster < 2) goto fail;
// error if not in FAT // error if not in FAT
if (cluster > (clusterCount_ + 1)) goto fail; if (cluster > (clusterCount_ + 1)) goto fail;
if (FAT12_SUPPORT && fatType_ == 12) { if (FAT12_SUPPORT && fatType_ == 12) {
uint16_t index = cluster; uint16_t index = cluster;
index += index >> 1; index += index >> 1;
lba = fatStartBlock_ + (index >> 9); lba = fatStartBlock_ + (index >> 9);
if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail; if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
// mirror second FAT // mirror second FAT
if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_; if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
index &= 0X1FF; index &= 0X1FF;
uint8_t tmp = value; uint8_t tmp = value;
if (cluster & 1) { if (cluster & 1) {
tmp = (cacheBuffer_.data[index] & 0XF) | tmp << 4; tmp = (cacheBuffer_.data[index] & 0XF) | tmp << 4;
} }
cacheBuffer_.data[index] = tmp; cacheBuffer_.data[index] = tmp;
index++; index++;
if (index == 512) { if (index == 512) {
lba++; lba++;
index = 0; index = 0;
if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail; if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
// mirror second FAT // mirror second FAT
if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_; if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
} }
tmp = value >> 4; tmp = value >> 4;
if (!(cluster & 1)) { if (!(cluster & 1)) {
tmp = ((cacheBuffer_.data[index] & 0XF0)) | tmp >> 4; tmp = ((cacheBuffer_.data[index] & 0XF0)) | tmp >> 4;
} }
cacheBuffer_.data[index] = tmp; cacheBuffer_.data[index] = tmp;
return true; return true;
} }
if (fatType_ == 16) { if (fatType_ == 16) {
lba = fatStartBlock_ + (cluster >> 8); lba = fatStartBlock_ + (cluster >> 8);
} else if (fatType_ == 32) { } else if (fatType_ == 32) {
lba = fatStartBlock_ + (cluster >> 7); lba = fatStartBlock_ + (cluster >> 7);
} else { } else {
goto fail; goto fail;
} }
if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail; if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
// store entry // store entry
if (fatType_ == 16) { if (fatType_ == 16) {
cacheBuffer_.fat16[cluster & 0XFF] = value; cacheBuffer_.fat16[cluster & 0XFF] = value;
} else { } else {
cacheBuffer_.fat32[cluster & 0X7F] = value; cacheBuffer_.fat32[cluster & 0X7F] = value;
} }
// mirror second FAT // mirror second FAT
if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_; if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// free a cluster chain // free a cluster chain
bool SdVolume::freeChain(uint32_t cluster) { bool SdVolume::freeChain(uint32_t cluster) {
uint32_t next; uint32_t next;
// clear free cluster location // clear free cluster location
allocSearchStart_ = 2; allocSearchStart_ = 2;
do { do {
if (!fatGet(cluster, &next)) goto fail; if (!fatGet(cluster, &next)) goto fail;
// free cluster // free cluster
if (!fatPut(cluster, 0)) goto fail; if (!fatPut(cluster, 0)) goto fail;
cluster = next; cluster = next;
} while (!isEOC(cluster)); } while (!isEOC(cluster));
return true; return true;
fail: fail:
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Volume free space in clusters. /** Volume free space in clusters.
* *
* \return Count of free clusters for success or -1 if an error occurs. * \return Count of free clusters for success or -1 if an error occurs.
*/ */
int32_t SdVolume::freeClusterCount() { int32_t SdVolume::freeClusterCount() {
uint32_t free = 0; uint32_t free = 0;
uint16_t n; uint16_t n;
uint32_t todo = clusterCount_ + 2; uint32_t todo = clusterCount_ + 2;
if (fatType_ == 16) { if (fatType_ == 16) {
n = 256; n = 256;
} else if (fatType_ == 32) { } else if (fatType_ == 32) {
n = 128; n = 128;
} else { } else {
// put FAT12 here // put FAT12 here
return -1; return -1;
} }
for (uint32_t lba = fatStartBlock_; todo; todo -= n, lba++) { for (uint32_t lba = fatStartBlock_; todo; todo -= n, lba++) {
if (!cacheRawBlock(lba, CACHE_FOR_READ)) return -1; if (!cacheRawBlock(lba, CACHE_FOR_READ)) return -1;
if (todo < n) n = todo; if (todo < n) n = todo;
if (fatType_ == 16) { if (fatType_ == 16) {
for (uint16_t i = 0; i < n; i++) { for (uint16_t i = 0; i < n; i++) {
if (cacheBuffer_.fat16[i] == 0) free++; if (cacheBuffer_.fat16[i] == 0) free++;
} }
} else { } else {
for (uint16_t i = 0; i < n; i++) { for (uint16_t i = 0; i < n; i++) {
if (cacheBuffer_.fat32[i] == 0) free++; if (cacheBuffer_.fat32[i] == 0) free++;
} }
} }
} }
return free; return free;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Initialize a FAT volume. /** Initialize a FAT volume.
* *
* \param[in] dev The SD card where the volume is located. * \param[in] dev The SD card where the volume is located.
* *
* \param[in] part The partition to be used. Legal values for \a part are * \param[in] part The partition to be used. Legal values for \a part are
* 1-4 to use the corresponding partition on a device formatted with * 1-4 to use the corresponding partition on a device formatted with
* a MBR, Master Boot Record, or zero if the device is formatted as * a MBR, Master Boot Record, or zero if the device is formatted as
* a super floppy with the FAT boot sector in block zero. * a super floppy with the FAT boot sector in block zero.
* *
* \return The value one, true, is returned for success and * \return The value one, true, is returned for success and
* the value zero, false, is returned for failure. Reasons for * the value zero, false, is returned for failure. Reasons for
* failure include not finding a valid partition, not finding a valid * failure include not finding a valid partition, not finding a valid
* FAT file system in the specified partition or an I/O error. * FAT file system in the specified partition or an I/O error.
*/ */
bool SdVolume::init(Sd2Card* dev, uint8_t part) { bool SdVolume::init(Sd2Card* dev, uint8_t part) {
uint32_t totalBlocks; uint32_t totalBlocks;
uint32_t volumeStartBlock = 0; uint32_t volumeStartBlock = 0;
fat32_boot_t* fbs; fat32_boot_t* fbs;
sdCard_ = dev; sdCard_ = dev;
fatType_ = 0; fatType_ = 0;
allocSearchStart_ = 2; allocSearchStart_ = 2;
cacheDirty_ = 0; // cacheFlush() will write block if true cacheDirty_ = 0; // cacheFlush() will write block if true
cacheMirrorBlock_ = 0; cacheMirrorBlock_ = 0;
cacheBlockNumber_ = 0XFFFFFFFF; cacheBlockNumber_ = 0XFFFFFFFF;
// if part == 0 assume super floppy with FAT boot sector in block zero // if part == 0 assume super floppy with FAT boot sector in block zero
// if part > 0 assume mbr volume with partition table // if part > 0 assume mbr volume with partition table
if (part) { if (part) {
if (part > 4)goto fail; if (part > 4)goto fail;
if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail; if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail;
part_t* p = &cacheBuffer_.mbr.part[part-1]; part_t* p = &cacheBuffer_.mbr.part[part-1];
if ((p->boot & 0X7F) !=0 || if ((p->boot & 0X7F) !=0 ||
p->totalSectors < 100 || p->totalSectors < 100 ||
p->firstSector == 0) { p->firstSector == 0) {
// not a valid partition // not a valid partition
goto fail; goto fail;
} }
volumeStartBlock = p->firstSector; volumeStartBlock = p->firstSector;
} }
if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail; if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail;
fbs = &cacheBuffer_.fbs32; fbs = &cacheBuffer_.fbs32;
if (fbs->bytesPerSector != 512 || if (fbs->bytesPerSector != 512 ||
fbs->fatCount == 0 || fbs->fatCount == 0 ||
fbs->reservedSectorCount == 0 || fbs->reservedSectorCount == 0 ||
fbs->sectorsPerCluster == 0) { fbs->sectorsPerCluster == 0) {
// not valid FAT volume // not valid FAT volume
goto fail; goto fail;
} }
fatCount_ = fbs->fatCount; fatCount_ = fbs->fatCount;
blocksPerCluster_ = fbs->sectorsPerCluster; blocksPerCluster_ = fbs->sectorsPerCluster;
// determine shift that is same as multiply by blocksPerCluster_ // determine shift that is same as multiply by blocksPerCluster_
clusterSizeShift_ = 0; clusterSizeShift_ = 0;
while (blocksPerCluster_ != (1 << clusterSizeShift_)) { while (blocksPerCluster_ != (1 << clusterSizeShift_)) {
// error if not power of 2 // error if not power of 2
if (clusterSizeShift_++ > 7) goto fail; if (clusterSizeShift_++ > 7) goto fail;
} }
blocksPerFat_ = fbs->sectorsPerFat16 ? blocksPerFat_ = fbs->sectorsPerFat16 ?
fbs->sectorsPerFat16 : fbs->sectorsPerFat32; fbs->sectorsPerFat16 : fbs->sectorsPerFat32;
fatStartBlock_ = volumeStartBlock + fbs->reservedSectorCount; fatStartBlock_ = volumeStartBlock + fbs->reservedSectorCount;
// count for FAT16 zero for FAT32 // count for FAT16 zero for FAT32
rootDirEntryCount_ = fbs->rootDirEntryCount; rootDirEntryCount_ = fbs->rootDirEntryCount;
// directory start for FAT16 dataStart for FAT32 // directory start for FAT16 dataStart for FAT32
rootDirStart_ = fatStartBlock_ + fbs->fatCount * blocksPerFat_; rootDirStart_ = fatStartBlock_ + fbs->fatCount * blocksPerFat_;
// data start for FAT16 and FAT32 // data start for FAT16 and FAT32
dataStartBlock_ = rootDirStart_ + ((32 * fbs->rootDirEntryCount + 511)/512); dataStartBlock_ = rootDirStart_ + ((32 * fbs->rootDirEntryCount + 511)/512);
// total blocks for FAT16 or FAT32 // total blocks for FAT16 or FAT32
totalBlocks = fbs->totalSectors16 ? totalBlocks = fbs->totalSectors16 ?
fbs->totalSectors16 : fbs->totalSectors32; fbs->totalSectors16 : fbs->totalSectors32;
// total data blocks // total data blocks
clusterCount_ = totalBlocks - (dataStartBlock_ - volumeStartBlock); clusterCount_ = totalBlocks - (dataStartBlock_ - volumeStartBlock);
// divide by cluster size to get cluster count // divide by cluster size to get cluster count
clusterCount_ >>= clusterSizeShift_; clusterCount_ >>= clusterSizeShift_;
// FAT type is determined by cluster count // FAT type is determined by cluster count
if (clusterCount_ < 4085) { if (clusterCount_ < 4085) {
fatType_ = 12; fatType_ = 12;
if (!FAT12_SUPPORT) goto fail; if (!FAT12_SUPPORT) goto fail;
} else if (clusterCount_ < 65525) { } else if (clusterCount_ < 65525) {
fatType_ = 16; fatType_ = 16;
} else { } else {
rootDirStart_ = fbs->fat32RootCluster; rootDirStart_ = fbs->fat32RootCluster;
fatType_ = 32; fatType_ = 32;
} }
return true; return true;
fail: fail:
return false; return false;
} }
#endif #endif

View File

@ -25,6 +25,21 @@ const char * const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_ADJUSTZ_DE MSG_ADJUSTZ_DE
}; };
const char MSG_ALL_EN[] PROGMEM = "All";
const char MSG_ALL_CZ[] PROGMEM = "Vse";
const char MSG_ALL_IT[] PROGMEM = "Tutti";
const char MSG_ALL_ES[] PROGMEM = "Todos";
const char MSG_ALL_PL[] PROGMEM = "Wszystko";
const char MSG_ALL_DE[] PROGMEM = "Alle";
const char * const MSG_ALL_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_ALL_EN,
MSG_ALL_CZ,
MSG_ALL_IT,
MSG_ALL_ES,
MSG_ALL_PL,
MSG_ALL_DE
};
const char MSG_AMAX_EN[] PROGMEM = "Amax "; const char MSG_AMAX_EN[] PROGMEM = "Amax ";
const char * const MSG_AMAX_LANG_TABLE[1] PROGMEM = { const char * const MSG_AMAX_LANG_TABLE[1] PROGMEM = {
MSG_AMAX_EN MSG_AMAX_EN
@ -590,6 +605,21 @@ const char * const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CHANGING_FILAMENT_DE MSG_CHANGING_FILAMENT_DE
}; };
const char MSG_CHOOSE_EXTRUDER_EN[] PROGMEM = "Choose extruder:";
const char MSG_CHOOSE_EXTRUDER_CZ[] PROGMEM = "Vyberte extruder:";
const char MSG_CHOOSE_EXTRUDER_IT[] PROGMEM = "Seleziona estrusore:";
const char MSG_CHOOSE_EXTRUDER_ES[] PROGMEM = "Elegir extrusor:";
const char MSG_CHOOSE_EXTRUDER_PL[] PROGMEM = "Wybierz ekstruder";
const char MSG_CHOOSE_EXTRUDER_DE[] PROGMEM = "Waehlen Sie Extruder";
const char * const MSG_CHOOSE_EXTRUDER_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CHOOSE_EXTRUDER_EN,
MSG_CHOOSE_EXTRUDER_CZ,
MSG_CHOOSE_EXTRUDER_IT,
MSG_CHOOSE_EXTRUDER_ES,
MSG_CHOOSE_EXTRUDER_PL,
MSG_CHOOSE_EXTRUDER_DE
};
const char MSG_CLEAN_NOZZLE_E_EN[] PROGMEM = "E calibration finished. Please clean the nozzle. Click when done."; const char MSG_CLEAN_NOZZLE_E_EN[] PROGMEM = "E calibration finished. Please clean the nozzle. Click when done.";
const char MSG_CLEAN_NOZZLE_E_CZ[] PROGMEM = "E kalibrace ukoncena. Prosim ocistete trysku. Po te potvrdte tlacitkem."; const char MSG_CLEAN_NOZZLE_E_CZ[] PROGMEM = "E kalibrace ukoncena. Prosim ocistete trysku. Po te potvrdte tlacitkem.";
const char MSG_CLEAN_NOZZLE_E_IT[] PROGMEM = "Calibrazione E terminata. Si prega di pulire l'ugello. Click per continuare."; const char MSG_CLEAN_NOZZLE_E_IT[] PROGMEM = "Calibrazione E terminata. Si prega di pulire l'ugello. Click per continuare.";
@ -700,6 +730,21 @@ const char * const MSG_COUNT_X_LANG_TABLE[1] PROGMEM = {
MSG_COUNT_X_EN MSG_COUNT_X_EN
}; };
const char MSG_CURRENT_EN[] PROGMEM = "Current";
const char MSG_CURRENT_CZ[] PROGMEM = "Pouze aktualni";
const char MSG_CURRENT_IT[] PROGMEM = "Attuale";
const char MSG_CURRENT_ES[] PROGMEM = "Actual";
const char MSG_CURRENT_PL[] PROGMEM = "Tylko aktualne";
const char MSG_CURRENT_DE[] PROGMEM = "Aktuelles";
const char * const MSG_CURRENT_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CURRENT_EN,
MSG_CURRENT_CZ,
MSG_CURRENT_IT,
MSG_CURRENT_ES,
MSG_CURRENT_PL,
MSG_CURRENT_DE
};
const char MSG_DISABLE_STEPPERS_EN[] PROGMEM = "Disable steppers"; const char MSG_DISABLE_STEPPERS_EN[] PROGMEM = "Disable steppers";
const char MSG_DISABLE_STEPPERS_CZ[] PROGMEM = "Vypnout motory"; const char MSG_DISABLE_STEPPERS_CZ[] PROGMEM = "Vypnout motory";
const char MSG_DISABLE_STEPPERS_IT[] PROGMEM = "Disabilit motori"; const char MSG_DISABLE_STEPPERS_IT[] PROGMEM = "Disabilit motori";
@ -812,6 +857,71 @@ const char * const MSG_EXTERNAL_RESET_LANG_TABLE[1] PROGMEM = {
MSG_EXTERNAL_RESET_EN MSG_EXTERNAL_RESET_EN
}; };
const char MSG_EXTRUDER_EN[] PROGMEM = "Extruder";
const char MSG_EXTRUDER_IT[] PROGMEM = "Estrusore";
const char MSG_EXTRUDER_ES[] PROGMEM = "Extrusor";
const char MSG_EXTRUDER_PL[] PROGMEM = "Ekstruder";
const char * const MSG_EXTRUDER_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_EXTRUDER_EN,
MSG_EXTRUDER_EN,
MSG_EXTRUDER_IT,
MSG_EXTRUDER_ES,
MSG_EXTRUDER_PL,
MSG_EXTRUDER_EN
};
const char MSG_EXTRUDER_1_EN[] PROGMEM = "Extruder 1";
const char MSG_EXTRUDER_1_IT[] PROGMEM = "Estrusore 1";
const char MSG_EXTRUDER_1_ES[] PROGMEM = "Extrusor 1";
const char MSG_EXTRUDER_1_PL[] PROGMEM = "Ekstruder 1";
const char * const MSG_EXTRUDER_1_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_EXTRUDER_1_EN,
MSG_EXTRUDER_1_EN,
MSG_EXTRUDER_1_IT,
MSG_EXTRUDER_1_ES,
MSG_EXTRUDER_1_PL,
MSG_EXTRUDER_1_EN
};
const char MSG_EXTRUDER_2_EN[] PROGMEM = "Extruder 2";
const char MSG_EXTRUDER_2_IT[] PROGMEM = "Estrusore 2";
const char MSG_EXTRUDER_2_ES[] PROGMEM = "Extrusor 2";
const char MSG_EXTRUDER_2_PL[] PROGMEM = "Ekstruder 2";
const char * const MSG_EXTRUDER_2_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_EXTRUDER_2_EN,
MSG_EXTRUDER_2_EN,
MSG_EXTRUDER_2_IT,
MSG_EXTRUDER_2_ES,
MSG_EXTRUDER_2_PL,
MSG_EXTRUDER_2_EN
};
const char MSG_EXTRUDER_3_EN[] PROGMEM = "Extruder 3";
const char MSG_EXTRUDER_3_IT[] PROGMEM = "Estrusore 3";
const char MSG_EXTRUDER_3_ES[] PROGMEM = "Extrusor 3";
const char MSG_EXTRUDER_3_PL[] PROGMEM = "Ekstruder 3";
const char * const MSG_EXTRUDER_3_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_EXTRUDER_3_EN,
MSG_EXTRUDER_3_EN,
MSG_EXTRUDER_3_IT,
MSG_EXTRUDER_3_ES,
MSG_EXTRUDER_3_PL,
MSG_EXTRUDER_3_EN
};
const char MSG_EXTRUDER_4_EN[] PROGMEM = "Extruder 4";
const char MSG_EXTRUDER_4_IT[] PROGMEM = "Estrusore 4";
const char MSG_EXTRUDER_4_ES[] PROGMEM = "Extrusor 4";
const char MSG_EXTRUDER_4_PL[] PROGMEM = "Ekstruder 4";
const char * const MSG_EXTRUDER_4_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_EXTRUDER_4_EN,
MSG_EXTRUDER_4_EN,
MSG_EXTRUDER_4_IT,
MSG_EXTRUDER_4_ES,
MSG_EXTRUDER_4_PL,
MSG_EXTRUDER_4_EN
};
const char MSG_E_CAL_KNOB_EN[] PROGMEM = "Rotate knob until mark reaches extruder body. Click when done."; const char MSG_E_CAL_KNOB_EN[] PROGMEM = "Rotate knob until mark reaches extruder body. Click when done.";
const char MSG_E_CAL_KNOB_CZ[] PROGMEM = "Otacejte tlacitkem dokud znacka nedosahne tela extruderu. Potvrdte tlacitkem."; const char MSG_E_CAL_KNOB_CZ[] PROGMEM = "Otacejte tlacitkem dokud znacka nedosahne tela extruderu. Potvrdte tlacitkem.";
const char MSG_E_CAL_KNOB_IT[] PROGMEM = "Girare la manopola affinche' il segno raggiunga il corpo dell'estrusore. Click per continuare."; const char MSG_E_CAL_KNOB_IT[] PROGMEM = "Girare la manopola affinche' il segno raggiunga il corpo dell'estrusore. Click per continuare.";
@ -3154,6 +3264,21 @@ const char * const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_USB_PRINTING_DE MSG_USB_PRINTING_DE
}; };
const char MSG_USED_EN[] PROGMEM = "Used during print";
const char MSG_USED_CZ[] PROGMEM = "Pouzite behem tisku";
const char MSG_USED_IT[] PROGMEM = "Usati nella stampa";
const char MSG_USED_ES[] PROGMEM = "Usado en impresion";
const char MSG_USED_PL[] PROGMEM = "Uzyte przy druku";
const char MSG_USED_DE[] PROGMEM = "Beim Druck benutzte";
const char * const MSG_USED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_USED_EN,
MSG_USED_CZ,
MSG_USED_IT,
MSG_USED_ES,
MSG_USED_PL,
MSG_USED_DE
};
const char MSG_USERWAIT_EN[] PROGMEM = "Wait for user..."; const char MSG_USERWAIT_EN[] PROGMEM = "Wait for user...";
const char MSG_USERWAIT_IT[] PROGMEM = "Attendendo utente"; const char MSG_USERWAIT_IT[] PROGMEM = "Attendendo utente";
const char MSG_USERWAIT_ES[] PROGMEM = "Esperando ordenes"; const char MSG_USERWAIT_ES[] PROGMEM = "Esperando ordenes";

View File

@ -29,7 +29,9 @@ extern unsigned char lang_selected;
extern const char* const MSG_ACTIVE_EXTRUDER_LANG_TABLE[1]; extern const char* const MSG_ACTIVE_EXTRUDER_LANG_TABLE[1];
#define MSG_ACTIVE_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_ACTIVE_EXTRUDER_LANG_TABLE, 0) #define MSG_ACTIVE_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_ACTIVE_EXTRUDER_LANG_TABLE, 0)
extern const char* const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM]; extern const char* const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM];
#define MSG_ADJUSTZ LANG_TABLE_SELECT(MSG_ADJUSTZ_LANG_TABLE) #define MSG_ADJUSTZ LANG_TABLE_SELECT(MSG_ADJUSTZ_LANG_TABLE)
extern const char* const MSG_ALL_LANG_TABLE[LANG_NUM];
#define MSG_ALL LANG_TABLE_SELECT(MSG_ALL_LANG_TABLE)
extern const char* const MSG_AMAX_LANG_TABLE[1]; extern const char* const MSG_AMAX_LANG_TABLE[1];
#define MSG_AMAX LANG_TABLE_SELECT_EXPLICIT(MSG_AMAX_LANG_TABLE, 0) #define MSG_AMAX LANG_TABLE_SELECT_EXPLICIT(MSG_AMAX_LANG_TABLE, 0)
extern const char* const MSG_AUTHOR_LANG_TABLE[1]; extern const char* const MSG_AUTHOR_LANG_TABLE[1];
@ -120,6 +122,8 @@ extern const char* const MSG_CHANGE_SUCCESS_LANG_TABLE[LANG_NUM];
#define MSG_CHANGE_SUCCESS LANG_TABLE_SELECT(MSG_CHANGE_SUCCESS_LANG_TABLE) #define MSG_CHANGE_SUCCESS LANG_TABLE_SELECT(MSG_CHANGE_SUCCESS_LANG_TABLE)
extern const char* const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM]; extern const char* const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM];
#define MSG_CHANGING_FILAMENT LANG_TABLE_SELECT(MSG_CHANGING_FILAMENT_LANG_TABLE) #define MSG_CHANGING_FILAMENT LANG_TABLE_SELECT(MSG_CHANGING_FILAMENT_LANG_TABLE)
extern const char* const MSG_CHOOSE_EXTRUDER_LANG_TABLE[LANG_NUM];
#define MSG_CHOOSE_EXTRUDER LANG_TABLE_SELECT(MSG_CHOOSE_EXTRUDER_LANG_TABLE)
extern const char* const MSG_CLEAN_NOZZLE_E_LANG_TABLE[LANG_NUM]; extern const char* const MSG_CLEAN_NOZZLE_E_LANG_TABLE[LANG_NUM];
#define MSG_CLEAN_NOZZLE_E LANG_TABLE_SELECT(MSG_CLEAN_NOZZLE_E_LANG_TABLE) #define MSG_CLEAN_NOZZLE_E LANG_TABLE_SELECT(MSG_CLEAN_NOZZLE_E_LANG_TABLE)
extern const char* const MSG_CNG_SDCARD_LANG_TABLE[1]; extern const char* const MSG_CNG_SDCARD_LANG_TABLE[1];
@ -140,6 +144,8 @@ extern const char* const MSG_CORRECTLY_LANG_TABLE[LANG_NUM];
#define MSG_CORRECTLY LANG_TABLE_SELECT(MSG_CORRECTLY_LANG_TABLE) #define MSG_CORRECTLY LANG_TABLE_SELECT(MSG_CORRECTLY_LANG_TABLE)
extern const char* const MSG_COUNT_X_LANG_TABLE[1]; extern const char* const MSG_COUNT_X_LANG_TABLE[1];
#define MSG_COUNT_X LANG_TABLE_SELECT_EXPLICIT(MSG_COUNT_X_LANG_TABLE, 0) #define MSG_COUNT_X LANG_TABLE_SELECT_EXPLICIT(MSG_COUNT_X_LANG_TABLE, 0)
extern const char* const MSG_CURRENT_LANG_TABLE[LANG_NUM];
#define MSG_CURRENT LANG_TABLE_SELECT(MSG_CURRENT_LANG_TABLE)
extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM]; extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM];
#define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE) #define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE)
extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM]; extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM];
@ -174,6 +180,16 @@ extern const char* const MSG_ERR_STOPPED_LANG_TABLE[1];
#define MSG_ERR_STOPPED LANG_TABLE_SELECT_EXPLICIT(MSG_ERR_STOPPED_LANG_TABLE, 0) #define MSG_ERR_STOPPED LANG_TABLE_SELECT_EXPLICIT(MSG_ERR_STOPPED_LANG_TABLE, 0)
extern const char* const MSG_EXTERNAL_RESET_LANG_TABLE[1]; extern const char* const MSG_EXTERNAL_RESET_LANG_TABLE[1];
#define MSG_EXTERNAL_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_EXTERNAL_RESET_LANG_TABLE, 0) #define MSG_EXTERNAL_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_EXTERNAL_RESET_LANG_TABLE, 0)
extern const char* const MSG_EXTRUDER_LANG_TABLE[LANG_NUM];
#define MSG_EXTRUDER LANG_TABLE_SELECT(MSG_EXTRUDER_LANG_TABLE)
extern const char* const MSG_EXTRUDER_1_LANG_TABLE[LANG_NUM];
#define MSG_EXTRUDER_1 LANG_TABLE_SELECT(MSG_EXTRUDER_1_LANG_TABLE)
extern const char* const MSG_EXTRUDER_2_LANG_TABLE[LANG_NUM];
#define MSG_EXTRUDER_2 LANG_TABLE_SELECT(MSG_EXTRUDER_2_LANG_TABLE)
extern const char* const MSG_EXTRUDER_3_LANG_TABLE[LANG_NUM];
#define MSG_EXTRUDER_3 LANG_TABLE_SELECT(MSG_EXTRUDER_3_LANG_TABLE)
extern const char* const MSG_EXTRUDER_4_LANG_TABLE[LANG_NUM];
#define MSG_EXTRUDER_4 LANG_TABLE_SELECT(MSG_EXTRUDER_4_LANG_TABLE)
extern const char* const MSG_E_CAL_KNOB_LANG_TABLE[LANG_NUM]; extern const char* const MSG_E_CAL_KNOB_LANG_TABLE[LANG_NUM];
#define MSG_E_CAL_KNOB LANG_TABLE_SELECT(MSG_E_CAL_KNOB_LANG_TABLE) #define MSG_E_CAL_KNOB LANG_TABLE_SELECT(MSG_E_CAL_KNOB_LANG_TABLE)
extern const char* const MSG_Enqueing_LANG_TABLE[1]; extern const char* const MSG_Enqueing_LANG_TABLE[1];
@ -582,6 +598,8 @@ extern const char* const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM];
#define MSG_UNLOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_4_LANG_TABLE) #define MSG_UNLOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_4_LANG_TABLE)
extern const char* const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM]; extern const char* const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM];
#define MSG_USB_PRINTING LANG_TABLE_SELECT(MSG_USB_PRINTING_LANG_TABLE) #define MSG_USB_PRINTING LANG_TABLE_SELECT(MSG_USB_PRINTING_LANG_TABLE)
extern const char* const MSG_USED_LANG_TABLE[LANG_NUM];
#define MSG_USED LANG_TABLE_SELECT(MSG_USED_LANG_TABLE)
extern const char* const MSG_USERWAIT_LANG_TABLE[LANG_NUM]; extern const char* const MSG_USERWAIT_LANG_TABLE[LANG_NUM];
#define MSG_USERWAIT LANG_TABLE_SELECT(MSG_USERWAIT_LANG_TABLE) #define MSG_USERWAIT LANG_TABLE_SELECT(MSG_USERWAIT_LANG_TABLE)
extern const char* const MSG_VMIN_LANG_TABLE[1]; extern const char* const MSG_VMIN_LANG_TABLE[1];

View File

@ -292,4 +292,13 @@
#define MSG_TEMP_CALIBRATION_DONE "Teplotni kalibrace dokoncena. Pokracujte stiskem tlacitka." #define MSG_TEMP_CALIBRATION_DONE "Teplotni kalibrace dokoncena. Pokracujte stiskem tlacitka."
#define MSG_TEMP_CALIBRATION_ON "Tepl. kal. [ON]" #define MSG_TEMP_CALIBRATION_ON "Tepl. kal. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Tepl. kal. [OFF]" #define MSG_TEMP_CALIBRATION_OFF "Tepl. kal. [OFF]"
#define MSG_PREPARE_FILAMENT "Pripravte filament" #define MSG_PREPARE_FILAMENT "Pripravte filament"
#define MSG_ALL "Vse"
#define MSG_USED "Pouzite behem tisku"
#define MSG_CURRENT "Pouze aktualni"
#define MSG_CHOOSE_EXTRUDER "Vyberte extruder:"
#define MSG_EXTRUDER "Extruder"
#define MSG_EXTRUDER_1 "Extruder 1"
#define MSG_EXTRUDER_2 "Extruder 2"
#define MSG_EXTRUDER_3 "Extruder 3"
#define MSG_EXTRUDER_4 "Extruder 4"

317
Firmware/language_de.h Normal file
View File

@ -0,0 +1,317 @@
+/**
+ * German
+ *
+ * LCD Menu Messages
+ * Please note these are limited to 17 characters!
+ *
+ */
+
+#define(length = 20) WELCOME_MSG CUSTOM_MENDEL_NAME " bereit."
+ #define MSG_SD_INSERTED "SD eingesetzt"
+ #define MSG_SD_REMOVED "SD entfernt "
+ #define MSG_MAIN "Hauptmenue"
+ #define MSG_DISABLE_STEPPERS "Motoren aus"
+ #define MSG_AUTO_HOME "Startposition"
+ #define MSG_SET_HOME_OFFSETS "Abstand vom Ursprung einstellen"
+ #define MSG_SET_ORIGIN "Ursprung einstellen"
+ #define MSG_COOLDOWN "Abkuehlen"
+ #define MSG_SWITCH_PS_ON "Netzteil EIN"
+ #define MSG_SWITCH_PS_OFF "Netzteil AUS"
+ #define MSG_MOVE_AXIS "Achsbewegung"
+ #define MSG_MOVE_X "Bewege X"
+ #define MSG_MOVE_Y "Bewege Y"
+ #define MSG_MOVE_Z "Bewege Z"
+ #define MSG_MOVE_E "Extruder"
+ #define MSG_SPEED "Geschwindigkeit"
+ #define MSG_NOZZLE "Duese"
+ #define MSG_NOZZLE1 "Duese2"
+ #define MSG_NOZZLE2 "Duese3"
+ #define MSG_BED "Bed"
+ #define MSG_FAN_SPEED "Luefter-Tempo"
+ #define MSG_FLOW "Durchfluss"
+ #define MSG_FLOW0 "Durchfluss 0"
+ #define MSG_FLOW1 "Durchfluss 1"
+ #define MSG_FLOW2 "Durchfluss 2"
+ #define MSG_CONTROL "Kontrolle"
+ #define MSG_MIN " \002 Min"
+ #define MSG_MAX " \002 Max"
+ #define MSG_FACTOR " \002 Fakt"
+ #define MSG_TEMPERATURE "Temperatur"
+ #define MSG_MOTION "Bewegung"
+ #define MSG_VOLUMETRIC "Filament"
+ #define MSG_VOLUMETRIC_ENABLED "E in mm3"
+ #define MSG_STORE_EPROM "Abspeichern"
+ #define MSG_LOAD_EPROM "Lade Speicher"
+ #define MSG_RESTORE_FAILSAFE "Standardwerte setzen"
+ #define MSG_REFRESH "\xF8" "Erneuern"
+ #define MSG_WATCH "Information"
+ #define MSG_TUNE "Feineinstellung"
+ #define MSG_PAUSE_PRINT "Druck unterbrech."
+ #define MSG_RESUME_PRINT "Fortsetzen"
+ #define MSG_STOP_PRINT "Druck abbrechen"
+ #define MSG_CARD_MENU "Drucken von SD"
+ #define MSG_NO_CARD "Keine SD Karte"
+ #define MSG_DWELL "Einen Moment bitte."
+ #define MSG_USERWAIT "Warte auf user..."
+ #define MSG_RESUMING "Druck fortgesetzt"
+ #define(length = 20) MSG_PRINT_ABORTED "Druck abgebrochen"
+ #define MSG_NO_MOVE "Keine Bewegung."
+ #define MSG_KILLED "ABGEBROCHEN. "
+ #define MSG_STOPPED "GESTOPPT. "
+ #define MSG_FILAMENTCHANGE "Filament-Wechsel"
+ #define MSG_INIT_SDCARD "Init SD Karte"
+ #define MSG_CNG_SDCARD "Wechsel SD Karte"
+ #define MSG_BABYSTEP_X "Babystep X"
+ #define MSG_BABYSTEP_Y "Babystep Y"
+ #define MSG_BABYSTEP_Z "Z einstellen"
+ #define MSG_ADJUSTZ "Auto Z einstellen?"
+ #define MSG_PICK_Z "Waehle Abdruck"
+
+#define MSG_SETTINGS "Einstellungen"
+ #define MSG_PREHEAT "Vorwaermen"
+ #define MSG_UNLOAD_FILAMENT "Filament entladen"
+ #define MSG_LOAD_FILAMENT "Filament laden"
+
+#define MSG_RECTRACT "Retract"
+ #define MSG_ERROR "FEHLER:"
+ #define(length = 20) MSG_PREHEAT_NOZZLE "Duese Vorwaermen"
+ #define MSG_SUPPORT "Support"
+ #define(length = 20) MSG_CORRECTLY "Wechsel ok?"
+ #define MSG_YES "Ja"
+ #define MSG_NO "Nein"
+ #define(length = 19) MSG_NOT_LOADED "Fil. nicht geladen"
+ #define MSG_NOT_COLOR "Farbe unklar"
+ #define(length = 20) MSG_LOADING_FILAMENT "Filament leadt"
+ #define(length = 20) MSG_PLEASE_WAIT "Bitte warten"
+ #define MSG_LOADING_COLOR "Lade Farbe"
+ #define MSG_CHANGE_SUCCESS "Wechsel erfolgr.!"
+ #define(length = 20) MSG_PRESS "und Knopf druecken"
+ #define(length = 20) MSG_INSERT_FILAMENT "Filament einlegen"
+ #define(length = 20) MSG_CHANGING_FILAMENT "Filament-Wechsel!"
+
+
+#define MSG_SILENT_MODE_ON "Mode [leise]"
+ #define MSG_SILENT_MODE_OFF "Mode [Hohe Leist]"
+ #define(length = 20) MSG_REBOOT "Zum Uebernehmen "
+ #define(length = 22) MSG_TAKE_EFFECT "Drucker neu starten"
+
+#define MSG_Enqueing "enqueuing \"
+ #define MSG_POWERUP "Einschalten"
+ #define MSG_CONFIGURATION_VER " Letztes Update:"
+ #define MSG_FREE_MEMORY " Freier Speicher: "
+ #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
+ #define MSG_OK "ok"
+ #define MSG_ERR_CHECKSUM_MISMATCH "Pruefsummenfehler, Letzte Zeile: " //Checksum Fehler, Letzte Zeile: "
+ #define MSG_ERR_NO_CHECKSUM "Keine Pruefsumme mit Zeilennummer, Letzte Zeile: " //Keine Checksum mit Zeilennummer, Letzte Zeile: "
+ #define MSG_BEGIN_FILE_LIST "Beginn Dateiliste"
+ #define MSG_END_FILE_LIST "Ende Dateiliste"
+ #define MSG_M104_INVALID_EXTRUDER "M104 Falscher Extruder"
+ #define MSG_M105_INVALID_EXTRUDER "M105 Falscher Extruder"
+ #define MSG_M200_INVALID_EXTRUDER "M200 Falscher Extruder"
+ #define MSG_M218_INVALID_EXTRUDER "M218 Falscher Extruder"
+ #define MSG_M221_INVALID_EXTRUDER "M221 Falscher Extruder"
+ #define MSG_ERR_NO_THERMISTORS "Keine Thermistoren - keine Temperatur"
+ #define MSG_M109_INVALID_EXTRUDER "M109 Falscher Extruder"
+ #define MSG_HEATING "Aufwaermen"
+ #define(length = 20) MSG_HEATING_COMPLETE "Aufwaermen OK"
+ #define MSG_BED_HEATING "Bed aufwaermen"
+ #define MSG_BED_DONE "Bed OK"
+ #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1.0.2; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" CUSTOM_MENDEL_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
+ #define MSG_ERR_KILLED "Printer gestoppt. kill() aufgerufen!"
+ #define MSG_ERR_STOPPED "Drucker aufgrund von Fehlern gestoppt. Fehler beheben und mit M999 neu starten. (Temperatur wird zurueckgesetzt. Nach dem Neustart neu einstellen!)"
+ #define MSG_RESEND "Wiederholen: "
+ #define MSG_M119_REPORT "Statusbericht Endanschlag"
+ #define MSG_ENDSTOP_HIT "AUSGELOEST"
+ #define MSG_ENDSTOP_OPEN "offen"
+
+#define MSG_SD_CANT_OPEN_SUBDIR "Kann Unterverz. nicht oeffnen"
+ #define MSG_SD_INIT_FAIL "SD Init fehlerhaft"
+ #define MSG_SD_VOL_INIT_FAIL "Dateisystem Init fehlerhaft"
+ #define MSG_SD_OPENROOT_FAIL "Zugriff auf Basisverzeichnis misslungen"
+ #define MSG_SD_CARD_OK "SD Karte ok"
+ #define MSG_SD_WORKDIR_FAIL "Oeffnen Arbeitsverzeichnis misslungen"
+ #define MSG_SD_OPEN_FILE_FAIL "Fehler beim Oeffnen der Datei: "
+ #define MSG_SD_FILE_OPENED "Datei geoeffnet: "
+ #define MSG_SD_FILE_SELECTED "Datei ausgewaehlt"
+ #define MSG_SD_WRITE_TO_FILE "Schreiben der Datei: "
+ #define MSG_SD_PRINTING_BYTE "SD printing byte "
+ #define MSG_SD_NOT_PRINTING "Kein SD Print"
+ #define MSG_SD_ERR_WRITE_TO_FILE "Fehler beim Schreiben in Datei"
+ #define MSG_SD_CANT_ENTER_SUBDIR "Zugangsproblem Unterverzeichnis: "
+ #define MSG_STEPPER_TOO_HIGH "Schrittrate zu hoch"
+ #define MSG_ENDSTOPS_HIT "Endanschlag erreicht"
+ #define MSG_ERR_COLD_EXTRUDE_STOP "Stopp, Extruder kalt!"
+ #define MSG_BABYSTEPPING_X "Babystepping X"
+ #define MSG_BABYSTEPPING_Y "Babystepping Y"
+ #define MSG_BABYSTEPPING_Z "Z wurde eingestellt"
+ #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Menuestruktur fehlerhaft"
+
+#define MSG_LANGUAGE_NAME "Deutsch"
+ #define MSG_LANGUAGE_SELECT "Waehle Sprache"
+ #define MSG_PRUSA3D "prusa3d.com"
+ #define MSG_PRUSA3D_FORUM "forum.prusa3d.com"
+ #define MSG_PRUSA3D_HOWTO "howto.prusa3d.com"
+
+#define MSG_SELFTEST_ERROR "Selbtest Fehler!"
+ #define MSG_SELFTEST_PLEASECHECK "Bitte pruefe:"
+ #define MSG_SELFTEST_NOTCONNECTED "Nicht angeschlossen"
+ #define MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor"
+ #define MSG_SELFTEST_BEDHEATER "Bed / Heater"
+ #define MSG_SELFTEST_WIRINGERROR "Verdrahtungfehler"
+ #define MSG_SELFTEST_ENDSTOPS "Endschalter"
+ #define MSG_SELFTEST_MOTOR "Motor"
+ #define MSG_SELFTEST_ENDSTOP "Endstop"
+ #define MSG_SELFTEST_ENDSTOP_NOTHIT "Ende nicht getrof."
+ #define MSG_SELFTEST_OK "Selbsttest OK"
+ #define MSG_LOOSE_PULLEY "Lose Riemenscheibe"
+
+#define MSG_SELFTEST_FAN "Lueftertest"
+#define(length = 20) MSG_SELFTEST_COOLING_FAN "Vorderer Luefter?"
+#define(length = 20) MSG_SELFTEST_EXTRUDER_FAN "Linker Luefter?"
+#define MSG_SELFTEST_FAN_YES "Dreht"
+#define MSG_SELFTEST_FAN_NO "Dreht nicht"
+
+#define(length = 20) MSG_STATS_TOTALFILAMENT "Gesamtfilament:"
+ #define(length = 20) MSG_STATS_TOTALPRINTTIME "Totale Druckzeit:"
+ #define(length = 20) MSG_STATS_FILAMENTUSED "Filamentverbrauch:"
+ #define(length = 20) MSG_STATS_PRINTTIME "Druckzeit: "
+ #define(length = 20) MSG_SELFTEST_START "Selbsttest start "
+ #define(length = 20) MSG_SELFTEST_CHECK_ENDSTOPS "Pruefe Endschalter "
+ #define(length = 20) MSG_SELFTEST_CHECK_HOTEND "Pruefe Hotend"
+ #define(length = 20) MSG_SELFTEST_CHECK_X "Pruefe X Achse "
+ #define(length = 20) MSG_SELFTEST_CHECK_Y "Pruefe Y Achse "
+ #define(length = 20) MSG_SELFTEST_CHECK_Z "Pruefe Z Achse "
+ #define(length = 20) MSG_SELFTEST_CHECK_BED "Pr\x81fe Bed "
+ #define(length = 20) MSG_SELFTEST_CHECK_ALLCORRECT "Alles richtig "
+ #define MSG_SELFTEST "Selbsttest "
+ #define(length = 20) MSG_SELFTEST_FAILED "Selbsttest misslung."
+ #define MSG_STATISTICS "Statistiken "
+ #define MSG_USB_PRINTING "Drucken ueber USB"
+ #define MSG_HOMEYZ "Kalibrieren Z"
+ #define MSG_HOMEYZ_PROGRESS "Kalibriere Z"
+ #define MSG_HOMEYZ_DONE "Kalibrierung OK"
+
+#define MSG_SHOW_END_STOPS "Endschalter Stat."
+ #define MSG_CALIBRATE_BED "Kalibrierung XYZ"
+ #define MSG_CALIBRATE_BED_RESET "Reset XYZ Kalibr."
+
+#define(length = 20, lines = 8) MSG_MOVE_CARRIAGE_TO_THE_TOP "Kalibrieren von XYZ. Drehen Sie den Knopf bis der obere Anschlag erreicht wird. Klicken wenn ganz oben."
+ #define(length = 20, lines = 8) MSG_MOVE_CARRIAGE_TO_THE_TOP_Z "Kalibrieren von Z. Drehen Sie den Knopf bis der obere Anschlag erreicht wird. Klicken wenn ganz oben."
+
+#define(length = 20, lines = 8) MSG_CONFIRM_NOZZLE_CLEAN "Bitte entfernen Sie ueberstehendes Filament von der Duese. Klicken wenn sauber."
+ #define(length = 20, lines = 2) MSG_CONFIRM_CARRIAGE_AT_THE_TOP "Ist der Schlitten ganz oben?"
+
+#define(length = 60) MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 "Suchen Bed Kalibrierpunkt"
+ #define(length = 14) MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 " von 4"
+ #define(length = 60) MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 "Verbesserung Bed Kalibrierpunkt"
+ #define(length = 14) MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " von 9"
+ #define(length = 60) MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Messen der Referenzhoehe des Kalibrierpunktes"
+ #define(length = 14) MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " von 9"
#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Iteration "
+
+#define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "XYZ-Kalibrierung fehlgeschlagen. Bed-Kalibrierpunkt nicht gefunden."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "XYZ-Kalibrierung fehlgeschlagen. Bitte schauen Sie in das Handbuch."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_PERFECT "XYZ-Kalibrierung ok. X/Y-Achsen sind senkrecht zueinander. Glueckwunsch!"
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD "XYZ Kalibrierung in Ordnung. X/Y Achsen sind etwas schief."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "XYZ Kalibrierung in Ordnung. Schiefheit wird automatisch korrigiert."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_LEFT_FAR "XYZ-Kalibrierung fehlgeschlagen. Linker vorderer Kalibrierpunkt ist zu weit vorne."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR "XYZ-Kalibrierung fehlgeschlagen. Rechter vorderer Kalibrierpunkt ist zu weit vorne."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR "XYZ-Kalibrierung fehlgeschlagen. Vordere Kalibrierpunkte sind zu weit vorne."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR "XYZ-Kalibrierung ungenau. Linker vorderer Kalibrierpunkt ist zu weit vorne."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR "XYZ-Kalibrierung ungenau. Rechter vorderer Kalibrierpunkt ist zu weit vorne."
+ #define(length = 20, lines = 8) MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR "XYZ-Kalibrierung ungenau. Vordere Kalibrierpunkte sind zu weit vorne."
+
+#define(length = 20, lines = 4) MSG_BED_LEVELING_FAILED_POINT_LOW "Z-Kal. fehlgeschlg. Sensor nicht ausgeloest. Schmutzige Duese? Warte auf Reset"
+ #define(length = 20, lines = 4) MSG_BED_LEVELING_FAILED_POINT_HIGH "Z-Kalibrierung fehlgeschlg. Sensor zu hoch ausgeloest. Warte auf Reset."
+ #define(length = 20, lines = 4) MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED "Z-Kalibrierung fehlgeschlg. Sensor nicht angeschlossen. Warte auf Reset."
+
+#define(length = 20, lines = 2) MSG_NEW_FIRMWARE_AVAILABLE "Neue Firmware Version verfuegbar:"
+ #define(length = 20) MSG_NEW_FIRMWARE_PLEASE_UPGRADE "Bitte aktualisieren."
+
+ #define(length = 20, lines = 8) MSG_FOLLOW_CALIBRATION_FLOW "Der Drucker wurde noch nicht kalibriert. Bitte folgen Sie dem Handbuch, Kapitel First steps, Abschnitt Calibration flow."
+ #define(length = 20, lines = 12) MSG_BABYSTEP_Z_NOT_SET "Der Abstand zwischen der Spitze der Duese und der Bed ist noch nicht eingestellt. Bitte folgen Sie dem Handbuch, First steps, section First layer calibration."
+
+
+ #define(length = 20, lines = 4) MSG_FILAMENT_LOADING_T0 "Filament in extruder 1 einlegen. Klicken wenn fertig."
+ #define(length = 20, lines = 4) MSG_FILAMENT_LOADING_T1 "Filament in extruder 2 einlegen. Klicken wenn fertig."
+ #define(length = 20, lines = 4) MSG_FILAMENT_LOADING_T2 "Filament in extruder 3 einlegen. Klicken wenn fertig."
+ #define(length = 20, lines = 4) MSG_FILAMENT_LOADING_T3 "Filament in extruder 4 einlegen. Klicken wenn fertig."
+ #define(length = 20, lines = 1) MSG_CHANGE_EXTR "Wechsel extruder"
+
+ #define(length = 20, lines = 4) MSG_FIL_ADJUSTING "Filament positionieren. Bitte warten."
+ #define(length = 20, lines = 8) MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filamente sind jetzt eingestellt. Bitte reinigen Sie die Duese zur Kalibrierung. Klicken wenn fertig."
+
+ #define(length = 20, lines = 1) MSG_CALIBRATE_E "Kalibriere E"
+//#define(length=20, lines=1) "Reset E Cal."
+#define(length = 20, lines = 8) MSG_E_CAL_KNOB "Knopf drehen bis die Filamentmarkierung erreicht ist. Klicken wenn fertig."
+
+//#define(length=20, lines=1) MSG_FARM_CARD_MENU "Farm mode print"
+#define(length = 20, lines = 8) MSG_MARK_FIL "Filament 100mm vom Extrudergehaeuse markieren. Klicken wenn Fertig."
+ #define(length = 20, lines = 8) MSG_CLEAN_NOZZLE_E "E-Kalibrierung beendet. Bitte reinigen Sie die Duese. Klicken wenn fertig."
+ #define(length = 20, lines = 3) MSG_WAITING_TEMP "Warten auf Abkuehlung von Heater und Bed."
+ #define(length = 20, lines = 2) MSG_FILAMENT_CLEAN "Ist Farbe rein?"
+ #define(lenght = 20, lines = 1) MSG_UNLOADING_FILAMENT "Filament auswerfen"
+ #define(length = 20, lines = 8) MSG_PAPER "Legen ein Blatt Papier unter die Duese waehrend der Kalibrierung der ersten 4 Punkte. Wenn die Duese das Papier einklemmt, Drucker sofort ausschalten"
+
+#define MSG_BED_CORRECTION_MENU "Bed level Korrekt"
+ #define MSG_BED_CORRECTION_LEFT "Links [um]"
+ #define MSG_BED_CORRECTION_RIGHT "Rechts [um]"
+ #define MSG_BED_CORRECTION_FRONT "Vorne [um]"
+ #define MSG_BED_CORRECTION_REAR "Hinten [um]"
+ #define MSG_BED_CORRECTION_RESET "Ruecksetzen"
+
+#define MSG_MESH_BED_LEVELING "Mesh Bed Leveling"
+ #define MSG_MENU_CALIBRATION "Kalibrierung"
+ #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD Karte [normal]"
+ #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD Karte [FlashAir]"
#define MSG_FINISHING_MOVEMENTS "Bewegung beenden"
#define MSG_PRINT_PAUSED "Druck pausiert"
#define MSG_RESUMING_PRINT "Druck weitergehen"
#define MSG_PID_EXTRUDER "PID Kalibrierung"
#define MSG_SET_TEMPERATURE "Temp. einsetzen"
#define MSG_PID_FINISHED "PID Kalib. fertig"
#define MSG_PID_RUNNING "PID Kalib."
#define MSG_CALIBRATE_PINDA "Kalibrieren"
#define MSG_CALIBRATION_PINDA_MENU "Temp. kalibrieren"
#define MSG_PINDA_NOT_CALIBRATED "Temperatur wurde nicht kalibriert"
#define MSG_PINDA_PREHEAT "PINDA erwaermen"
#define MSG_TEMP_CALIBRATION "Temp Kalib. "
#define MSG_TEMP_CALIBRATION_DONE "Temp. Kalibrierung fertig. Klicken um weiter zu gehen."
#define MSG_TEMP_CALIBRATION_ON "Temp. Kal. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Temp. Kal. [OFF]"
#define MSG_LOAD_ALL "Alle laden"
#define MSG_LOAD_FILAMENT_1 "Filament 1 laden"
#define MSG_LOAD_FILAMENT_2 "Filament 2 laden"
#define MSG_LOAD_FILAMENT_3 "Filament 3 laden"
#define MSG_LOAD_FILAMENT_4 "Filament 4 laden"
#define MSG_UNLOAD_FILAMENT_1 "Filam. 1 entladen"
#define MSG_UNLOAD_FILAMENT_2 "Filam. 2 entladen"
#define MSG_UNLOAD_FILAMENT_3 "Filam. 3 entladen"
#define MSG_UNLOAD_FILAMENT_4 "Filam. 4 entladen"
#define MSG_UNLOAD_ALL "Alles entladen"
#define MSG_PREPARE_FILAMENT "Filam. bereithalten"
#define MSG_ALL "Alle"
#define MSG_USED "Beim Druck benutzte"
#define MSG_CURRENT "Aktuelles"
#define MSG_CHOOSE_EXTRUDER "Waehlen Sie Extruder"
#define MSG_EXTRUDER "Extruder"
#define MSG_EXTRUDER_1 "Extruder 1"
#define MSG_EXTRUDER_2 "Extruder 2"
#define MSG_EXTRUDER_3 "Extruder 3"
#define MSG_EXTRUDER_4 "Extruder 4"

View File

@ -273,9 +273,9 @@
#define MSG_MESH_BED_LEVELING "Mesh Bed Leveling" #define MSG_MESH_BED_LEVELING "Mesh Bed Leveling"
#define MSG_MENU_CALIBRATION "Calibration" #define MSG_MENU_CALIBRATION "Calibration"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]" #define(length=19, lines=1) MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]" #define(length=19, lines=1) MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_PRINTER_DISCONNECTED "Printer disconnected" #define(length=20, lines=1) MSG_PRINTER_DISCONNECTED "Printer disconnected"
#define(length=20, lines=1) MSG_FINISHING_MOVEMENTS "Finishing movements" #define(length=20, lines=1) MSG_FINISHING_MOVEMENTS "Finishing movements"
#define(length=20, lines=1) MSG_PRINT_PAUSED "Print paused" #define(length=20, lines=1) MSG_PRINT_PAUSED "Print paused"
#define(length=20, lines=1) MSG_RESUMING_PRINT "Resuming print" #define(length=20, lines=1) MSG_RESUMING_PRINT "Resuming print"
@ -293,5 +293,13 @@
#define(length=20, lines=1) MSG_TEMP_CALIBRATION_ON "Temp. cal. [ON]" #define(length=20, lines=1) MSG_TEMP_CALIBRATION_ON "Temp. cal. [ON]"
#define(length=20, lines=1) MSG_TEMP_CALIBRATION_OFF "Temp. cal. [OFF]" #define(length=20, lines=1) MSG_TEMP_CALIBRATION_OFF "Temp. cal. [OFF]"
#define(length=20, lines=1) MSG_PREPARE_FILAMENT "Prepare new filament" #define(length=20, lines=1) MSG_PREPARE_FILAMENT "Prepare new filament"
#define(length=19, lines=1) MSG_ALL "All"
#define(length=19, lines=1) MSG_USED "Used during print"
#define(length=19, lines=1) MSG_CURRENT "Current"
#define(length=20, lines=1) MSG_CHOOSE_EXTRUDER "Choose extruder:"
#define(length=17, lines=1) MSG_EXTRUDER "Extruder"
#define(length=17, lines=1) MSG_EXTRUDER_1 "Extruder 1"
#define(length=17, lines=1) MSG_EXTRUDER_2 "Extruder 2"
#define(length=17, lines=1) MSG_EXTRUDER_3 "Extruder 3"
#define(length=17, lines=1) MSG_EXTRUDER_4 "Extruder 4"

View File

@ -286,4 +286,13 @@
#define MSG_UNLOAD_FILAMENT_3 "Soltar fil. 3" #define MSG_UNLOAD_FILAMENT_3 "Soltar fil. 3"
#define MSG_UNLOAD_FILAMENT_4 "Soltar fil. 4" #define MSG_UNLOAD_FILAMENT_4 "Soltar fil. 4"
#define MSG_UNLOAD_ALL "Soltar todos fil." #define MSG_UNLOAD_ALL "Soltar todos fil."
#define MSG_PREPARE_FILAMENT "Preparar filamento" #define MSG_PREPARE_FILAMENT "Preparar filamento"
#define MSG_ALL "Todos"
#define MSG_USED "Usado en impresion"
#define MSG_CURRENT "Actual"
#define MSG_CHOOSE_EXTRUDER "Elegir extrusor:"
#define MSG_EXTRUDER "Extrusor"
#define MSG_EXTRUDER_1 "Extrusor 1"
#define MSG_EXTRUDER_2 "Extrusor 2"
#define MSG_EXTRUDER_3 "Extrusor 3"
#define MSG_EXTRUDER_4 "Extrusor 4"

View File

@ -1,280 +1,289 @@
#define WELCOME_MSG CUSTOM_MENDEL_NAME " pronta." #define WELCOME_MSG CUSTOM_MENDEL_NAME " pronta."
#define MSG_SD_INSERTED "SD inserita" #define MSG_SD_INSERTED "SD inserita"
#define MSG_SD_REMOVED "SD rimossa" #define MSG_SD_REMOVED "SD rimossa"
#define MSG_MAIN "Menu principale" #define MSG_MAIN "Menu principale"
#define MSG_DISABLE_STEPPERS "Disabilit motori" #define MSG_DISABLE_STEPPERS "Disabilit motori"
#define MSG_AUTO_HOME "Trova origine" #define MSG_AUTO_HOME "Trova origine"
#define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Set origin" #define MSG_SET_ORIGIN "Set origin"
#define MSG_COOLDOWN "Raffredda" #define MSG_COOLDOWN "Raffredda"
#define MSG_SWITCH_PS_ON "Switch power on" #define MSG_SWITCH_PS_ON "Switch power on"
#define MSG_SWITCH_PS_OFF "Switch power off" #define MSG_SWITCH_PS_OFF "Switch power off"
#define MSG_MOVE_AXIS "Muovi asse" #define MSG_MOVE_AXIS "Muovi asse"
#define MSG_MOVE_X "Muovi X" #define MSG_MOVE_X "Muovi X"
#define MSG_MOVE_Y "Muovi Y" #define MSG_MOVE_Y "Muovi Y"
#define MSG_MOVE_Z "Muovi Z" #define MSG_MOVE_Z "Muovi Z"
#define MSG_MOVE_E "Muovi Estrusore" #define MSG_MOVE_E "Muovi Estrusore"
#define MSG_MOVE_01MM "Move 0.1mm" #define MSG_MOVE_01MM "Move 0.1mm"
#define MSG_MOVE_1MM "Move 1mm" #define MSG_MOVE_1MM "Move 1mm"
#define MSG_MOVE_10MM "Move 10mm" #define MSG_MOVE_10MM "Move 10mm"
#define MSG_SPEED "Velocita" #define MSG_SPEED "Velocita"
#define MSG_NOZZLE "Ugello" #define MSG_NOZZLE "Ugello"
#define MSG_NOZZLE1 "Nozzle2" #define MSG_NOZZLE1 "Nozzle2"
#define MSG_NOZZLE2 "Nozzle3" #define MSG_NOZZLE2 "Nozzle3"
#define MSG_BED "Letto" #define MSG_BED "Letto"
#define MSG_FAN_SPEED "Velocita vent." #define MSG_FAN_SPEED "Velocita vent."
#define MSG_FLOW "Flusso" #define MSG_FLOW "Flusso"
#define MSG_TEMPERATURE "Temperatura" #define MSG_TEMPERATURE "Temperatura"
#define MSG_MOTION "Motion" #define MSG_MOTION "Motion"
#define MSG_VOLUMETRIC "Filament" #define MSG_VOLUMETRIC "Filament"
#define MSG_VOLUMETRIC_ENABLED "E in mm3" #define MSG_VOLUMETRIC_ENABLED "E in mm3"
#define MSG_STORE_EPROM "Store memory" #define MSG_STORE_EPROM "Store memory"
#define MSG_LOAD_EPROM "Load memory" #define MSG_LOAD_EPROM "Load memory"
#define MSG_RESTORE_FAILSAFE "Restore failsafe" #define MSG_RESTORE_FAILSAFE "Restore failsafe"
#define MSG_REFRESH "\xF8" "Refresh" #define MSG_REFRESH "\xF8" "Refresh"
#define MSG_WATCH "Schermata info" #define MSG_WATCH "Schermata info"
#define MSG_TUNE "Regola" #define MSG_TUNE "Regola"
#define MSG_PAUSE_PRINT "Metti in pausa" #define MSG_PAUSE_PRINT "Metti in pausa"
#define MSG_RESUME_PRINT "Riprendi stampa" #define MSG_RESUME_PRINT "Riprendi stampa"
#define MSG_STOP_PRINT "Arresta stampa" #define MSG_STOP_PRINT "Arresta stampa"
#define MSG_CARD_MENU "Stampa da SD" #define MSG_CARD_MENU "Stampa da SD"
#define MSG_NO_CARD "Nessuna SD" #define MSG_NO_CARD "Nessuna SD"
#define MSG_DWELL "Sospensione..." #define MSG_DWELL "Sospensione..."
#define MSG_USERWAIT "Attendendo utente" #define MSG_USERWAIT "Attendendo utente"
#define MSG_RESUMING "Riprendi stampa" #define MSG_RESUMING "Riprendi stampa"
#define MSG_PRINT_ABORTED "Stampa abortita" #define MSG_PRINT_ABORTED "Stampa abortita"
#define MSG_NO_MOVE "Nessun movimento." #define MSG_NO_MOVE "Nessun movimento."
#define MSG_KILLED "IN TILT." #define MSG_KILLED "IN TILT."
#define MSG_STOPPED "ARRESTATO." #define MSG_STOPPED "ARRESTATO."
#define MSG_FILAMENTCHANGE "Camb. filamento" #define MSG_FILAMENTCHANGE "Camb. filamento"
#define MSG_INIT_SDCARD "Init. SD card" #define MSG_INIT_SDCARD "Init. SD card"
#define MSG_CNG_SDCARD "Change SD card" #define MSG_CNG_SDCARD "Change SD card"
#define MSG_ZPROBE_OUT "Z probe out. bed" #define MSG_ZPROBE_OUT "Z probe out. bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset" #define MSG_ZPROBE_ZOFFSET "Z Offset"
#define MSG_BABYSTEP_X "Babystep X" #define MSG_BABYSTEP_X "Babystep X"
#define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Y "Babystep Y"
#define MSG_BABYSTEP_Z "Compensazione Z" #define MSG_BABYSTEP_Z "Compensazione Z"
#define MSG_ADJUSTZ "Autoregolare Z?" #define MSG_ADJUSTZ "Autoregolare Z?"
#define MSG_PICK_Z "Pick print" #define MSG_PICK_Z "Pick print"
#define MSG_SETTINGS "Impostazioni" #define MSG_SETTINGS "Impostazioni"
#define MSG_PREHEAT "Preriscalda" #define MSG_PREHEAT "Preriscalda"
#define MSG_HEATING "Riscaldamento..." #define MSG_HEATING "Riscaldamento..."
#define MSG_SUPPORT "Support" #define MSG_SUPPORT "Support"
#define MSG_YES "Si" #define MSG_YES "Si"
#define MSG_NO "No" #define MSG_NO "No"
#define MSG_NOT_LOADED "Fil. non caricato" #define MSG_NOT_LOADED "Fil. non caricato"
#define MSG_NOT_COLOR "Colore non puro" #define MSG_NOT_COLOR "Colore non puro"
#define MSG_LOADING_COLOR "Caricando colore" #define MSG_LOADING_COLOR "Caricando colore"
#define MSG_CHANGE_SUCCESS "Cambio riuscito!" #define MSG_CHANGE_SUCCESS "Cambio riuscito!"
#define MSG_PRESS "e cliccare manopola" #define MSG_PRESS "e cliccare manopola"
#define MSG_INSERT_FILAMENT "Inserire filamento" #define MSG_INSERT_FILAMENT "Inserire filamento"
#define MSG_CHANGING_FILAMENT "Cambiando filam." #define MSG_CHANGING_FILAMENT "Cambiando filam."
#define MSG_PLEASE_WAIT "Aspetta" #define MSG_PLEASE_WAIT "Aspetta"
#define MSG_PREHEAT_NOZZLE "Preris. ugello!" #define MSG_PREHEAT_NOZZLE "Preris. ugello!"
#define MSG_HEATING_COMPLETE "Riscald. completo" #define MSG_HEATING_COMPLETE "Riscald. completo"
#define MSG_BED_HEATING "Riscald. letto" #define MSG_BED_HEATING "Riscald. letto"
#define MSG_BED_DONE "Piatto fatto." #define MSG_BED_DONE "Piatto fatto."
#define MSG_ERROR "ERRORE:" #define MSG_ERROR "ERRORE:"
#define MSG_CORRECTLY "Cambiato corr.?" #define MSG_CORRECTLY "Cambiato corr.?"
#define MSG_LOADING_FILAMENT "Caricando filam." #define MSG_LOADING_FILAMENT "Caricando filam."
#define MSG_UNLOAD_FILAMENT "Scarica filamento" #define MSG_UNLOAD_FILAMENT "Scarica filamento"
#define MSG_LOAD_FILAMENT "Carica filamento" #define MSG_LOAD_FILAMENT "Carica filamento"
#define MSG_SILENT_MODE_ON "Modo [silenzioso]" #define MSG_SILENT_MODE_ON "Modo [silenzioso]"
#define MSG_SILENT_MODE_OFF "Mode [forte]" #define MSG_SILENT_MODE_OFF "Mode [forte]"
#define MSG_REBOOT "Riavvia stampante" #define MSG_REBOOT "Riavvia stampante"
#define MSG_TAKE_EFFECT " per attualizzare" #define MSG_TAKE_EFFECT " per attualizzare"
#define MSG_Enqueing "enqueing \"" #define MSG_Enqueing "enqueing \""
#define MSG_POWERUP "PowerUp" #define MSG_POWERUP "PowerUp"
#define MSG_CONFIGURATION_VER " Last Updated: " #define MSG_CONFIGURATION_VER " Last Updated: "
#define MSG_FREE_MEMORY " Free Memory: " #define MSG_FREE_MEMORY " Free Memory: "
#define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
#define MSG_OK "ok" #define MSG_OK "ok"
#define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "
#define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: "
#define MSG_BEGIN_FILE_LIST "Begin file list" #define MSG_BEGIN_FILE_LIST "Begin file list"
#define MSG_END_FILE_LIST "End file list" #define MSG_END_FILE_LIST "End file list"
#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder " #define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder " #define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
#define MSG_M221_INVALID_EXTRUDER "M221 Invalid extruder " #define MSG_M221_INVALID_EXTRUDER "M221 Invalid extruder "
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1.0.2; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" CUSTOM_MENDEL_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n" #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1.0.2; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" CUSTOM_MENDEL_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define MSG_ERR_KILLED "Printer halted. kill() called!" #define MSG_ERR_KILLED "Printer halted. kill() called!"
#define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)" #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"
#define MSG_RESEND "Resend: " #define MSG_RESEND "Resend: "
#define MSG_M119_REPORT "Reporting endstop status" #define MSG_M119_REPORT "Reporting endstop status"
#define MSG_ENDSTOP_HIT "TRIGGERED" #define MSG_ENDSTOP_HIT "TRIGGERED"
#define MSG_ENDSTOP_OPEN "open" #define MSG_ENDSTOP_OPEN "open"
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir" #define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
#define MSG_SD_INIT_FAIL "SD init fail" #define MSG_SD_INIT_FAIL "SD init fail"
#define MSG_SD_VOL_INIT_FAIL "volume.init failed" #define MSG_SD_VOL_INIT_FAIL "volume.init failed"
#define MSG_SD_OPENROOT_FAIL "openRoot failed" #define MSG_SD_OPENROOT_FAIL "openRoot failed"
#define MSG_SD_CARD_OK "SD card ok" #define MSG_SD_CARD_OK "SD card ok"
#define MSG_SD_WORKDIR_FAIL "workDir open failed" #define MSG_SD_WORKDIR_FAIL "workDir open failed"
#define MSG_SD_OPEN_FILE_FAIL "open failed, File: " #define MSG_SD_OPEN_FILE_FAIL "open failed, File: "
#define MSG_SD_FILE_OPENED "File opened: " #define MSG_SD_FILE_OPENED "File opened: "
#define MSG_SD_FILE_SELECTED "File selected" #define MSG_SD_FILE_SELECTED "File selected"
#define MSG_SD_WRITE_TO_FILE "Writing to file: " #define MSG_SD_WRITE_TO_FILE "Writing to file: "
#define MSG_SD_PRINTING_BYTE "SD printing byte " #define MSG_SD_PRINTING_BYTE "SD printing byte "
#define MSG_SD_NOT_PRINTING "Not SD printing" #define MSG_SD_NOT_PRINTING "Not SD printing"
#define MSG_SD_ERR_WRITE_TO_FILE "error writing to file" #define MSG_SD_ERR_WRITE_TO_FILE "error writing to file"
#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: " #define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: "
#define MSG_STEPPER_TOO_HIGH "Steprate too high: " #define MSG_STEPPER_TOO_HIGH "Steprate too high: "
#define MSG_ENDSTOPS_HIT "endstops hit: " #define MSG_ENDSTOPS_HIT "endstops hit: "
#define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented"
#define MSG_BABYSTEPPING_X "Babystepping X" #define MSG_BABYSTEPPING_X "Babystepping X"
#define MSG_BABYSTEPPING_Y "Babystepping Y" #define MSG_BABYSTEPPING_Y "Babystepping Y"
#define MSG_BABYSTEPPING_Z "Adjusting Z" #define MSG_BABYSTEPPING_Z "Adjusting Z"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Error in menu structure" #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Error in menu structure"
#define MSG_LANGUAGE_NAME "Italiano" #define MSG_LANGUAGE_NAME "Italiano"
#define MSG_LANGUAGE_SELECT "Seleziona lingua" #define MSG_LANGUAGE_SELECT "Seleziona lingua"
#define MSG_PRUSA3D "prusa3d.com" #define MSG_PRUSA3D "prusa3d.com"
#define MSG_PRUSA3D_FORUM "forum.prusa3d.com" #define MSG_PRUSA3D_FORUM "forum.prusa3d.com"
#define MSG_PRUSA3D_HOWTO "howto.prusa3d.com" #define MSG_PRUSA3D_HOWTO "howto.prusa3d.com"
#define MSG_SELFTEST_ERROR "Autotest negativo" #define MSG_SELFTEST_ERROR "Autotest negativo"
#define MSG_SELFTEST_PLEASECHECK "Verificare:" #define MSG_SELFTEST_PLEASECHECK "Verificare:"
#define MSG_SELFTEST_NOTCONNECTED "Non connesso" #define MSG_SELFTEST_NOTCONNECTED "Non connesso"
#define MSG_SELFTEST_HEATERTHERMISTOR "Riscald./Termist." #define MSG_SELFTEST_HEATERTHERMISTOR "Riscald./Termist."
#define MSG_SELFTEST_BEDHEATER "Letto/Riscald." #define MSG_SELFTEST_BEDHEATER "Letto/Riscald."
#define MSG_SELFTEST_WIRINGERROR "Errore cablaggio" #define MSG_SELFTEST_WIRINGERROR "Errore cablaggio"
#define MSG_SELFTEST_ENDSTOPS "Finecorsa (2)" #define MSG_SELFTEST_ENDSTOPS "Finecorsa (2)"
#define MSG_SELFTEST_MOTOR "Motore" #define MSG_SELFTEST_MOTOR "Motore"
#define MSG_SELFTEST_ENDSTOP "Finecorsa" #define MSG_SELFTEST_ENDSTOP "Finecorsa"
#define MSG_SELFTEST_ENDSTOP_NOTHIT "Finec. fuori por." #define MSG_SELFTEST_ENDSTOP_NOTHIT "Finec. fuori por."
#define MSG_SELFTEST_OK "Autotest OK" #define MSG_SELFTEST_OK "Autotest OK"
#define(length=20) MSG_SELFTEST_FAN "Prova del ventilator"; #define(length=20) MSG_SELFTEST_FAN "Prova del ventilator";
#define(length=20) MSG_SELFTEST_COOLING_FAN "Vent di stampa ant.?"; #define(length=20) MSG_SELFTEST_COOLING_FAN "Vent di stampa ant.?";
#define(length=20) MSG_SELFTEST_EXTRUDER_FAN "Vent SX sull'ugello?"; #define(length=20) MSG_SELFTEST_EXTRUDER_FAN "Vent SX sull'ugello?";
#define MSG_SELFTEST_FAN_YES "Gira"; #define MSG_SELFTEST_FAN_YES "Gira";
#define MSG_SELFTEST_FAN_NO "Non si gira"; #define MSG_SELFTEST_FAN_NO "Non si gira";
#define MSG_STATS_TOTALFILAMENT "Filamento tot:" #define MSG_STATS_TOTALFILAMENT "Filamento tot:"
#define MSG_STATS_TOTALPRINTTIME "Tempo stampa tot:" #define MSG_STATS_TOTALPRINTTIME "Tempo stampa tot:"
#define MSG_STATS_FILAMENTUSED "Filamento usato:" #define MSG_STATS_FILAMENTUSED "Filamento usato:"
#define MSG_STATS_PRINTTIME "Tempo di stampa:" #define MSG_STATS_PRINTTIME "Tempo di stampa:"
#define MSG_SELFTEST_START "Avvia autotest" #define MSG_SELFTEST_START "Avvia autotest"
#define MSG_SELFTEST_CHECK_ENDSTOPS "Verifica finecorsa" #define MSG_SELFTEST_CHECK_ENDSTOPS "Verifica finecorsa"
#define MSG_SELFTEST_CHECK_HOTEND "Verifica ugello" #define MSG_SELFTEST_CHECK_HOTEND "Verifica ugello"
#define MSG_SELFTEST_CHECK_X "Verifica asse X" #define MSG_SELFTEST_CHECK_X "Verifica asse X"
#define MSG_SELFTEST_CHECK_Y "Verifica asse Y" #define MSG_SELFTEST_CHECK_Y "Verifica asse Y"
#define MSG_SELFTEST_CHECK_Z "Verifica asse Z" #define MSG_SELFTEST_CHECK_Z "Verifica asse Z"
#define MSG_SELFTEST_CHECK_BED "Verifica letto" #define MSG_SELFTEST_CHECK_BED "Verifica letto"
#define MSG_SELFTEST_CHECK_ALLCORRECT "Nessun errore" #define MSG_SELFTEST_CHECK_ALLCORRECT "Nessun errore"
#define MSG_SELFTEST "Autotest" #define MSG_SELFTEST "Autotest"
#define MSG_SELFTEST_FAILED "Autotest fallito" #define MSG_SELFTEST_FAILED "Autotest fallito"
#define MSG_STATISTICS "Statistiche" #define MSG_STATISTICS "Statistiche"
#define MSG_USB_PRINTING "Stampa da USB" #define MSG_USB_PRINTING "Stampa da USB"
#define MSG_HOMEYZ "Calibra Z" #define MSG_HOMEYZ "Calibra Z"
#define MSG_HOMEYZ_PROGRESS "Calibrando Z" #define MSG_HOMEYZ_PROGRESS "Calibrando Z"
#define MSG_HOMEYZ_DONE "Calibrazione OK" #define MSG_HOMEYZ_DONE "Calibrazione OK"
#define MSG_SHOW_END_STOPS "Stato finecorsa" #define MSG_SHOW_END_STOPS "Stato finecorsa"
#define MSG_CALIBRATE_BED "Calibra XYZ" #define MSG_CALIBRATE_BED "Calibra XYZ"
#define MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." #define MSG_CALIBRATE_BED_RESET "Reset XYZ calibr."
#define MSG_MOVE_CARRIAGE_TO_THE_TOP "Calibrazione XYZ. Ruotare la manopola per alzare il carrello Z fino all'altezza massima. Click per terminare." #define MSG_MOVE_CARRIAGE_TO_THE_TOP "Calibrazione XYZ. Ruotare la manopola per alzare il carrello Z fino all'altezza massima. Click per terminare."
#define MSG_MOVE_CARRIAGE_TO_THE_TOP_Z "Calibrazione Z. Ruotare la manopola per alzare il carrello Z fino all'altezza massima. Click per terminare." #define MSG_MOVE_CARRIAGE_TO_THE_TOP_Z "Calibrazione Z. Ruotare la manopola per alzare il carrello Z fino all'altezza massima. Click per terminare."
#define MSG_CONFIRM_NOZZLE_CLEAN "Pulire l'ugello per la calibrazione, poi fare click." #define MSG_CONFIRM_NOZZLE_CLEAN "Pulire l'ugello per la calibrazione, poi fare click."
#define MSG_CONFIRM_CARRIAGE_AT_THE_TOP "I carrelli Z sin/des sono altezza max?" #define MSG_CONFIRM_CARRIAGE_AT_THE_TOP "I carrelli Z sin/des sono altezza max?"
#define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 "Ricerca del letto punto di calibraz." #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 "Ricerca del letto punto di calibraz."
#define MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 " su 4" #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 " su 4"
#define MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 "Perfezion. il letto punto di calibraz." #define MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 "Perfezion. il letto punto di calibraz."
#define MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " su 9" #define MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " su 9"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Misurare l'altezza di riferimento del punto di calibrazione" #define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Misurare l'altezza di riferimento del punto di calibrazione"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " su 9" #define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " su 9"
#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Reiterazione " #define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Reiterazione "
#define MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "Calibrazione XYZ fallita. Il punto di calibrazione sul letto non e' stato trovato." #define MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "Calibrazione XYZ fallita. Il punto di calibrazione sul letto non e' stato trovato."
#define MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "Calibrazione XYZ fallita. Si prega di consultare il manuale." #define MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "Calibrazione XYZ fallita. Si prega di consultare il manuale."
#define MSG_BED_SKEW_OFFSET_DETECTION_PERFECT "Calibrazione XYZ OK. Gli assi X/Y sono perpendicolari. Complimenti!" #define MSG_BED_SKEW_OFFSET_DETECTION_PERFECT "Calibrazione XYZ OK. Gli assi X/Y sono perpendicolari. Complimenti!"
#define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD "Calibrazion XYZ corretta. Assi X/Y leggermente storti. Ben fatto!" #define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD "Calibrazion XYZ corretta. Assi X/Y leggermente storti. Ben fatto!"
#define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "Calibrazion XYZ corretta. La distorsione verra' automaticamente compensata." #define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "Calibrazion XYZ corretta. La distorsione verra' automaticamente compensata."
#define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_LEFT_FAR "Calibrazione XYZ fallita. Punto anteriore sinistro non raggiungibile." #define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_LEFT_FAR "Calibrazione XYZ fallita. Punto anteriore sinistro non raggiungibile."
#define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR "Calibrazione XYZ fallita. Punto anteriore destro non raggiungibile." #define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR "Calibrazione XYZ fallita. Punto anteriore destro non raggiungibile."
#define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR "Calibrazione XYZ fallita. Punti anteriori non raggiungibili." #define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR "Calibrazione XYZ fallita. Punti anteriori non raggiungibili."
#define MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR "Calibrazione XYZ compromessa. Punto anteriore sinistro non raggiungibile." #define MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR "Calibrazione XYZ compromessa. Punto anteriore sinistro non raggiungibile."
#define MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR "Calibrazione XYZ compromessa. Punto anteriore destro non raggiungibile." #define MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR "Calibrazione XYZ compromessa. Punto anteriore destro non raggiungibile."
#define MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR "Calibrazione XYZ compromessa. Punti anteriori non raggiungibili." #define MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR "Calibrazione XYZ compromessa. Punti anteriori non raggiungibili."
#define MSG_BED_LEVELING_FAILED_POINT_LOW "Livellamento letto fallito.NoRispSensor Residui su ugello? In attesa di reset." #define MSG_BED_LEVELING_FAILED_POINT_LOW "Livellamento letto fallito.NoRispSensor Residui su ugello? In attesa di reset."
#define MSG_BED_LEVELING_FAILED_POINT_HIGH "Livellamento letto fallito.Risp sensore troppo prestoIn attesa di reset." #define MSG_BED_LEVELING_FAILED_POINT_HIGH "Livellamento letto fallito.Risp sensore troppo prestoIn attesa di reset."
#define MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED "Livellamento letto fallito. Sensore discon. o Cavo Dann. In attesa di reset." #define MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED "Livellamento letto fallito. Sensore discon. o Cavo Dann. In attesa di reset."
#define MSG_NEW_FIRMWARE_AVAILABLE "Nuova versione del firmware disponibile" #define MSG_NEW_FIRMWARE_AVAILABLE "Nuova versione del firmware disponibile"
#define MSG_NEW_FIRMWARE_PLEASE_UPGRADE "Prega aggiorna." #define MSG_NEW_FIRMWARE_PLEASE_UPGRADE "Prega aggiorna."
#define MSG_FOLLOW_CALIBRATION_FLOW "Stampante ancora non calibrata. Si prega di seguire il manuale, capitolo PRIMI PASSI, sezione della calibrazione." #define MSG_FOLLOW_CALIBRATION_FLOW "Stampante ancora non calibrata. Si prega di seguire il manuale, capitolo PRIMI PASSI, sezione della calibrazione."
#define MSG_BABYSTEP_Z_NOT_SET "Distanza tra la punta dell'ugello e la superficie del letto non ancora imposta. Si prega di seguire il manuale, capitolo First steps, sezione First layer calibration." #define MSG_BABYSTEP_Z_NOT_SET "Distanza tra la punta dell'ugello e la superficie del letto non ancora imposta. Si prega di seguire il manuale, capitolo First steps, sezione First layer calibration."
#define MSG_BED_CORRECTION_MENU "Correz. liv.letto" #define MSG_BED_CORRECTION_MENU "Correz. liv.letto"
#define MSG_BED_CORRECTION_LEFT "Sinistra [um]" #define MSG_BED_CORRECTION_LEFT "Sinistra [um]"
#define MSG_BED_CORRECTION_RIGHT "Destra [um]" #define MSG_BED_CORRECTION_RIGHT "Destra [um]"
#define MSG_BED_CORRECTION_FRONT "Fronte [um]" #define MSG_BED_CORRECTION_FRONT "Fronte [um]"
#define MSG_BED_CORRECTION_REAR "Retro [um]" #define MSG_BED_CORRECTION_REAR "Retro [um]"
#define MSG_BED_CORRECTION_RESET "Reset" #define MSG_BED_CORRECTION_RESET "Reset"
#define MSG_MESH_BED_LEVELING "Mesh livel. letto" #define MSG_MESH_BED_LEVELING "Mesh livel. letto"
#define MSG_MENU_CALIBRATION "Calibrazione" #define MSG_MENU_CALIBRATION "Calibrazione"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_LOOSE_PULLEY "Puleggia lenta" #define MSG_LOOSE_PULLEY "Puleggia lenta"
#define MSG_FILAMENT_LOADING_T0 "Inserire filamento nell'estrusore 1. Click per continuare." #define MSG_FILAMENT_LOADING_T0 "Inserire filamento nell'estrusore 1. Click per continuare."
#define MSG_FILAMENT_LOADING_T1 "Inserire filamento nell'estrusore 2. Click per continuare." #define MSG_FILAMENT_LOADING_T1 "Inserire filamento nell'estrusore 2. Click per continuare."
#define MSG_FILAMENT_LOADING_T2 "Inserire filamento nell'estrusore 3. Click per continuare." #define MSG_FILAMENT_LOADING_T2 "Inserire filamento nell'estrusore 3. Click per continuare."
#define MSG_FILAMENT_LOADING_T3 "Inserire filamento nell'estrusore 4. Click per continuare." #define MSG_FILAMENT_LOADING_T3 "Inserire filamento nell'estrusore 4. Click per continuare."
#define MSG_CHANGE_EXTR "Cambio estrusore." #define MSG_CHANGE_EXTR "Cambio estrusore."
#define MSG_FIL_ADJUSTING "Filamento in fase di regolazione. Attendere prego." #define MSG_FIL_ADJUSTING "Filamento in fase di regolazione. Attendere prego."
#define MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "I filamenti sono regolati. Si prega di pulire l'ugello per la calibrazione. Click per continuare." #define MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "I filamenti sono regolati. Si prega di pulire l'ugello per la calibrazione. Click per continuare."
#define MSG_CALIBRATE_E "Calibra E" #define MSG_CALIBRATE_E "Calibra E"
#define MSG_E_CAL_KNOB "Girare la manopola affinche' il segno raggiunga il corpo dell'estrusore. Click per continuare." #define MSG_E_CAL_KNOB "Girare la manopola affinche' il segno raggiunga il corpo dell'estrusore. Click per continuare."
#define MSG_MARK_FIL "Segnare il filamento a 100 mm di distanza dal corpo dell'estrusore. Click per continuare." #define MSG_MARK_FIL "Segnare il filamento a 100 mm di distanza dal corpo dell'estrusore. Click per continuare."
#define MSG_CLEAN_NOZZLE_E "Calibrazione E terminata. Si prega di pulire l'ugello. Click per continuare." #define MSG_CLEAN_NOZZLE_E "Calibrazione E terminata. Si prega di pulire l'ugello. Click per continuare."
#define MSG_WAITING_TEMP "In attesa del raffreddamento della testina e del piatto" #define MSG_WAITING_TEMP "In attesa del raffreddamento della testina e del piatto"
#define MSG_FILAMENT_CLEAN "Il colore e' nitido?" #define MSG_FILAMENT_CLEAN "Il colore e' nitido?"
#define MSG_UNLOADING_FILAMENT "Rilasc. filamento" #define MSG_UNLOADING_FILAMENT "Rilasc. filamento"
#define MSG_PAPER "Porre un foglio sotto l'ugello durante la calibrazione dei primi 4 punti. In caso l'ugello muova il foglio spegnere prontamente la stampante." #define MSG_PAPER "Porre un foglio sotto l'ugello durante la calibrazione dei primi 4 punti. In caso l'ugello muova il foglio spegnere prontamente la stampante."
#define MSG_FINISHING_MOVEMENTS "Arresto in corso" #define MSG_FINISHING_MOVEMENTS "Arresto in corso"
#define MSG_PRINT_PAUSED "Stampa in pausa" #define MSG_PRINT_PAUSED "Stampa in pausa"
#define MSG_RESUMING_PRINT "Stampa in ripresa" #define MSG_RESUMING_PRINT "Stampa in ripresa"
#define MSG_PID_EXTRUDER "Calibrazione PID" #define MSG_PID_EXTRUDER "Calibrazione PID"
#define MSG_SET_TEMPERATURE "Imposta temperatura" #define MSG_SET_TEMPERATURE "Imposta temperatura"
#define MSG_PID_FINISHED "Cal. PID completa" #define MSG_PID_FINISHED "Cal. PID completa"
#define MSG_PID_RUNNING "Cal. PID" #define MSG_PID_RUNNING "Cal. PID"
#define MSG_CALIBRATE_PINDA "Calibrare" #define MSG_CALIBRATE_PINDA "Calibrare"
#define MSG_CALIBRATION_PINDA_MENU "Taratura temp." #define MSG_CALIBRATION_PINDA_MENU "Taratura temp."
#define MSG_PINDA_NOT_CALIBRATED "Taratura della temperatura non ancora eseguita" #define MSG_PINDA_NOT_CALIBRATED "Taratura della temperatura non ancora eseguita"
#define MSG_PINDA_PREHEAT "Riscald. PINDA" #define MSG_PINDA_PREHEAT "Riscald. PINDA"
#define MSG_TEMP_CALIBRATION "Cal. temp. " #define MSG_TEMP_CALIBRATION "Cal. temp. "
#define MSG_TEMP_CALIBRATION_DONE "Taratura temperatura terminata. Fare click per continuare." #define MSG_TEMP_CALIBRATION_DONE "Taratura temperatura terminata. Fare click per continuare."
#define MSG_TEMP_CALIBRATION_ON "Cal. temp. [ON]" #define MSG_TEMP_CALIBRATION_ON "Cal. temp. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Cal. temp. [OFF]" #define MSG_TEMP_CALIBRATION_OFF "Cal. temp. [OFF]"
#define MSG_LOAD_ALL "Caricare tutti" #define MSG_LOAD_ALL "Caricare tutti"
#define MSG_LOAD_FILAMENT_1 "Caricare fil. 1" #define MSG_LOAD_FILAMENT_1 "Caricare fil. 1"
#define MSG_LOAD_FILAMENT_2 "Caricare fil. 2" #define MSG_LOAD_FILAMENT_2 "Caricare fil. 2"
#define MSG_LOAD_FILAMENT_3 "Caricare fil. 3" #define MSG_LOAD_FILAMENT_3 "Caricare fil. 3"
#define MSG_LOAD_FILAMENT_4 "Caricare fil. 4" #define MSG_LOAD_FILAMENT_4 "Caricare fil. 4"
#define MSG_UNLOAD_FILAMENT_1 "Rilasciare fil. 1" #define MSG_UNLOAD_FILAMENT_1 "Rilasciare fil. 1"
#define MSG_UNLOAD_FILAMENT_2 "Rilasciare fil. 1" #define MSG_UNLOAD_FILAMENT_2 "Rilasciare fil. 1"
#define MSG_UNLOAD_FILAMENT_3 "Rilasciare fil. 1" #define MSG_UNLOAD_FILAMENT_3 "Rilasciare fil. 1"
#define MSG_UNLOAD_FILAMENT_4 "Rilasciare fil. 1" #define MSG_UNLOAD_FILAMENT_4 "Rilasciare fil. 1"
#define MSG_UNLOAD_ALL "Rilasciare tutti" #define MSG_UNLOAD_ALL "Rilasciare tutti"
#define MSG_PREPARE_FILAMENT "Preparare filamento" #define MSG_PREPARE_FILAMENT "Preparare filamento"
#define MSG_ALL "Tutti"
#define MSG_USED "Usati nella stampa"
#define MSG_CURRENT "Attuale"
#define MSG_CHOOSE_EXTRUDER "Seleziona estrusore:"
#define MSG_EXTRUDER "Estrusore"
#define MSG_EXTRUDER_1 "Estrusore 1"
#define MSG_EXTRUDER_2 "Estrusore 2"
#define MSG_EXTRUDER_3 "Estrusore 3"
#define MSG_EXTRUDER_4 "Estrusore 4"

View File

@ -289,4 +289,13 @@
#define MSG_UNLOAD_FILAMENT_3 "Wyjac filament 3" #define MSG_UNLOAD_FILAMENT_3 "Wyjac filament 3"
#define MSG_UNLOAD_FILAMENT_4 "Wyjac filament 4" #define MSG_UNLOAD_FILAMENT_4 "Wyjac filament 4"
#define MSG_UNLOAD_ALL "Wyjac wszystkie" #define MSG_UNLOAD_ALL "Wyjac wszystkie"
#define MSG_PREPARE_FILAMENT "Przygotuj filament" #define MSG_PREPARE_FILAMENT "Przygotuj filament"
#define MSG_ALL "Wszystko"
#define MSG_USED "Uzyte przy druku"
#define MSG_CURRENT "Tylko aktualne"
#define MSG_CHOOSE_EXTRUDER "Wybierz ekstruder"
#define MSG_EXTRUDER "Ekstruder"
#define MSG_EXTRUDER_1 "Ekstruder 1"
#define MSG_EXTRUDER_2 "Ekstruder 2"
#define MSG_EXTRUDER_3 "Ekstruder 3"
#define MSG_EXTRUDER_4 "Ekstruder 4"

File diff suppressed because it is too large Load Diff

View File

@ -1,182 +1,186 @@
#ifndef MESH_BED_CALIBRATION_H #ifndef MESH_BED_CALIBRATION_H
#define MESH_BED_CALIBRATION_H #define MESH_BED_CALIBRATION_H
// Exact positions of the print head above the bed reference points, in the world coordinates. // Exact positions of the print head above the bed reference points, in the world coordinates.
// The world coordinates match the machine coordinates only in case, when the machine // The world coordinates match the machine coordinates only in case, when the machine
// is built properly, the end stops are at the correct positions and the axes are perpendicular. // is built properly, the end stops are at the correct positions and the axes are perpendicular.
extern const float bed_ref_points[] PROGMEM; extern const float bed_ref_points[] PROGMEM;
// Is the world2machine correction activated? extern const float bed_skew_angle_mild;
enum World2MachineCorrectionMode extern const float bed_skew_angle_extreme;
{
WORLD2MACHINE_CORRECTION_NONE = 0, // Is the world2machine correction activated?
WORLD2MACHINE_CORRECTION_SHIFT = 1, enum World2MachineCorrectionMode
WORLD2MACHINE_CORRECTION_SKEW = 2, {
}; WORLD2MACHINE_CORRECTION_NONE = 0,
extern uint8_t world2machine_correction_mode; WORLD2MACHINE_CORRECTION_SHIFT = 1,
// 2x2 transformation matrix from the world coordinates to the machine coordinates. WORLD2MACHINE_CORRECTION_SKEW = 2,
// Corrects for the rotation and skew of the machine axes. };
// Used by the planner's plan_buffer_line() and plan_set_position(). extern uint8_t world2machine_correction_mode;
extern float world2machine_rotation_and_skew[2][2]; // 2x2 transformation matrix from the world coordinates to the machine coordinates.
extern float world2machine_rotation_and_skew_inv[2][2]; // Corrects for the rotation and skew of the machine axes.
// Shift of the machine zero point, in the machine coordinates. // Used by the planner's plan_buffer_line() and plan_set_position().
extern float world2machine_shift[2]; extern float world2machine_rotation_and_skew[2][2];
extern float world2machine_rotation_and_skew_inv[2][2];
// Resets the transformation to identity. // Shift of the machine zero point, in the machine coordinates.
extern void world2machine_reset(); extern float world2machine_shift[2];
// Resets the transformation to identity and update current_position[X,Y] from the servos.
extern void world2machine_revert_to_uncorrected(); // Resets the transformation to identity.
// Loads the transformation from the EEPROM, if available. extern void world2machine_reset();
extern void world2machine_initialize(); // Resets the transformation to identity and update current_position[X,Y] from the servos.
extern void world2machine_revert_to_uncorrected();
// When switching from absolute to corrected coordinates, // Loads the transformation from the EEPROM, if available.
// this will apply an inverse world2machine transformation extern void world2machine_initialize();
// to current_position[x,y].
extern void world2machine_update_current(); // When switching from absolute to corrected coordinates,
// this will apply an inverse world2machine transformation
inline void world2machine(const float &x, const float &y, float &out_x, float &out_y) // to current_position[x,y].
{ extern void world2machine_update_current();
if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
// No correction. inline void world2machine(const float &x, const float &y, float &out_x, float &out_y)
out_x = x; {
out_y = y; if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
} else { // No correction.
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) { out_x = x;
// Firs the skew & rotation correction. out_y = y;
out_x = world2machine_rotation_and_skew[0][0] * x + world2machine_rotation_and_skew[0][1] * y; } else {
out_y = world2machine_rotation_and_skew[1][0] * x + world2machine_rotation_and_skew[1][1] * y; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) {
} // Firs the skew & rotation correction.
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) { out_x = world2machine_rotation_and_skew[0][0] * x + world2machine_rotation_and_skew[0][1] * y;
// Then add the offset. out_y = world2machine_rotation_and_skew[1][0] * x + world2machine_rotation_and_skew[1][1] * y;
out_x += world2machine_shift[0]; }
out_y += world2machine_shift[1]; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) {
} // Then add the offset.
} out_x += world2machine_shift[0];
} out_y += world2machine_shift[1];
}
inline void world2machine(float &x, float &y) }
{ }
if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
// No correction. inline void world2machine(float &x, float &y)
} else { {
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) { if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
// Firs the skew & rotation correction. // No correction.
float out_x = world2machine_rotation_and_skew[0][0] * x + world2machine_rotation_and_skew[0][1] * y; } else {
float out_y = world2machine_rotation_and_skew[1][0] * x + world2machine_rotation_and_skew[1][1] * y; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) {
x = out_x; // Firs the skew & rotation correction.
y = out_y; float out_x = world2machine_rotation_and_skew[0][0] * x + world2machine_rotation_and_skew[0][1] * y;
} float out_y = world2machine_rotation_and_skew[1][0] * x + world2machine_rotation_and_skew[1][1] * y;
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) { x = out_x;
// Then add the offset. y = out_y;
x += world2machine_shift[0]; }
y += world2machine_shift[1]; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) {
} // Then add the offset.
} x += world2machine_shift[0];
} y += world2machine_shift[1];
}
inline void machine2world(float x, float y, float &out_x, float &out_y) }
{ }
if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
// No correction. inline void machine2world(float x, float y, float &out_x, float &out_y)
out_x = x; {
out_y = y; if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
} else { // No correction.
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) { out_x = x;
// Then add the offset. out_y = y;
x -= world2machine_shift[0]; } else {
y -= world2machine_shift[1]; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) {
} // Then add the offset.
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) { x -= world2machine_shift[0];
// Firs the skew & rotation correction. y -= world2machine_shift[1];
out_x = world2machine_rotation_and_skew_inv[0][0] * x + world2machine_rotation_and_skew_inv[0][1] * y; }
out_y = world2machine_rotation_and_skew_inv[1][0] * x + world2machine_rotation_and_skew_inv[1][1] * y; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) {
} // Firs the skew & rotation correction.
} out_x = world2machine_rotation_and_skew_inv[0][0] * x + world2machine_rotation_and_skew_inv[0][1] * y;
} out_y = world2machine_rotation_and_skew_inv[1][0] * x + world2machine_rotation_and_skew_inv[1][1] * y;
}
inline void machine2world(float &x, float &y) }
{ }
if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
// No correction. inline void machine2world(float &x, float &y)
} else { {
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) { if (world2machine_correction_mode == WORLD2MACHINE_CORRECTION_NONE) {
// Then add the offset. // No correction.
x -= world2machine_shift[0]; } else {
y -= world2machine_shift[1]; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SHIFT) {
} // Then add the offset.
if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) { x -= world2machine_shift[0];
// Firs the skew & rotation correction. y -= world2machine_shift[1];
float out_x = world2machine_rotation_and_skew_inv[0][0] * x + world2machine_rotation_and_skew_inv[0][1] * y; }
float out_y = world2machine_rotation_and_skew_inv[1][0] * x + world2machine_rotation_and_skew_inv[1][1] * y; if (world2machine_correction_mode & WORLD2MACHINE_CORRECTION_SKEW) {
x = out_x; // Firs the skew & rotation correction.
y = out_y; float out_x = world2machine_rotation_and_skew_inv[0][0] * x + world2machine_rotation_and_skew_inv[0][1] * y;
} float out_y = world2machine_rotation_and_skew_inv[1][0] * x + world2machine_rotation_and_skew_inv[1][1] * y;
} x = out_x;
} y = out_y;
}
inline bool world2machine_clamp(float &x, float &y) }
{ }
bool clamped = false;
float tmpx, tmpy; inline bool world2machine_clamp(float &x, float &y)
world2machine(x, y, tmpx, tmpy); {
if (tmpx < X_MIN_POS) { bool clamped = false;
tmpx = X_MIN_POS; float tmpx, tmpy;
clamped = true; world2machine(x, y, tmpx, tmpy);
} if (tmpx < X_MIN_POS) {
if (tmpy < Y_MIN_POS) { tmpx = X_MIN_POS;
tmpy = Y_MIN_POS; clamped = true;
clamped = true; }
} if (tmpy < Y_MIN_POS) {
if (tmpx > X_MAX_POS) { tmpy = Y_MIN_POS;
tmpx = X_MAX_POS; clamped = true;
clamped = true; }
} if (tmpx > X_MAX_POS) {
if (tmpy > Y_MAX_POS) { tmpx = X_MAX_POS;
tmpy = Y_MAX_POS; clamped = true;
clamped = true; }
} if (tmpy > Y_MAX_POS) {
if (clamped) tmpy = Y_MAX_POS;
machine2world(tmpx, tmpy, x, y); clamped = true;
return clamped; }
} if (clamped)
machine2world(tmpx, tmpy, x, y);
extern bool find_bed_induction_sensor_point_z(float minimum_z = -10.f, uint8_t n_iter = 3); return clamped;
extern bool find_bed_induction_sensor_point_xy(); }
extern void go_home_with_z_lift();
extern bool find_bed_induction_sensor_point_z(float minimum_z = -10.f, uint8_t n_iter = 3, int verbosity_level = 0);
// Positive or zero: ok extern bool find_bed_induction_sensor_point_xy(int verbosity_level = 0);
// Negative: failed extern void go_home_with_z_lift();
enum BedSkewOffsetDetectionResultType {
// Detection failed, some point was not found. // Positive or zero: ok
BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1, // Negative: failed
BED_SKEW_OFFSET_DETECTION_FITTING_FAILED = -2, enum BedSkewOffsetDetectionResultType {
// Detection failed, some point was not found.
// Detection finished with success. BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1,
BED_SKEW_OFFSET_DETECTION_PERFECT = 0, BED_SKEW_OFFSET_DETECTION_FITTING_FAILED = -2,
BED_SKEW_OFFSET_DETECTION_SKEW_MILD = 1,
BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME = 2 // Detection finished with success.
}; BED_SKEW_OFFSET_DETECTION_PERFECT = 0,
BED_SKEW_OFFSET_DETECTION_SKEW_MILD = 1,
extern BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level); BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME = 2
extern BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8_t verbosity_level, uint8_t &too_far_mask); };
extern bool sample_mesh_and_store_reference(); extern BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level, uint8_t &too_far_mask);
extern BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8_t verbosity_level, uint8_t &too_far_mask);
extern void reset_bed_offset_and_skew();
extern bool is_bed_z_jitter_data_valid(); extern bool sample_mesh_and_store_reference();
// Scan the mesh bed induction points one by one by a left-right zig-zag movement, extern void reset_bed_offset_and_skew();
// write the trigger coordinates to the serial line. extern bool is_bed_z_jitter_data_valid();
// Useful for visualizing the behavior of the bed induction detector.
extern bool scan_bed_induction_points(int8_t verbosity_level); // Scan the mesh bed induction points one by one by a left-right zig-zag movement,
// write the trigger coordinates to the serial line.
// Apply Z babystep value from the EEPROM through the planner. // Useful for visualizing the behavior of the bed induction detector.
extern void babystep_apply(); extern bool scan_bed_induction_points(int8_t verbosity_level);
// Undo the current Z babystep value. // Apply Z babystep value from the EEPROM through the planner.
extern void babystep_undo(); extern void babystep_apply();
// Reset the current babystep counter without moving the axes. // Undo the current Z babystep value.
extern void babystep_reset(); extern void babystep_undo();
#endif /* MESH_BED_CALIBRATION_H */ // Reset the current babystep counter without moving the axes.
extern void babystep_reset();
extern void count_xyz_details();
#endif /* MESH_BED_CALIBRATION_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,211 +1,211 @@
/* /*
temperature.h - temperature controller temperature.h - temperature controller
Part of Marlin Part of Marlin
Copyright (c) 2011 Erik van der Zalm Copyright (c) 2011 Erik van der Zalm
Grbl is free software: you can redistribute it and/or modify Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Grbl is distributed in the hope that it will be useful, Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>. along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef temperature_h #ifndef temperature_h
#define temperature_h #define temperature_h
#include "Marlin.h" #include "Marlin.h"
#include "planner.h" #include "planner.h"
#ifdef PID_ADD_EXTRUSION_RATE #ifdef PID_ADD_EXTRUSION_RATE
#include "stepper.h" #include "stepper.h"
#endif #endif
// public functions // public functions
void tp_init(); //initialize the heating void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically. void manage_heater(); //it is critical that this is called periodically.
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
// For converting raw Filament Width to milimeters // For converting raw Filament Width to milimeters
float analog2widthFil(); float analog2widthFil();
// For converting raw Filament Width to an extrusion ratio // For converting raw Filament Width to an extrusion ratio
int widthFil_to_size_ratio(); int widthFil_to_size_ratio();
#endif #endif
// low level conversion routines // low level conversion routines
// do not use these routines and variables outside of temperature.cpp // do not use these routines and variables outside of temperature.cpp
extern int target_temperature[EXTRUDERS]; extern int target_temperature[EXTRUDERS];
extern float current_temperature[EXTRUDERS]; extern float current_temperature[EXTRUDERS];
#ifdef SHOW_TEMP_ADC_VALUES #ifdef SHOW_TEMP_ADC_VALUES
extern int current_temperature_raw[EXTRUDERS]; extern int current_temperature_raw[EXTRUDERS];
extern int current_temperature_bed_raw; extern int current_temperature_bed_raw;
#endif #endif
extern int target_temperature_bed; extern int target_temperature_bed;
extern float current_temperature_bed; extern float current_temperature_bed;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #ifdef TEMP_SENSOR_1_AS_REDUNDANT
extern float redundant_temperature; extern float redundant_temperature;
#endif #endif
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
extern unsigned char soft_pwm_bed; extern unsigned char soft_pwm_bed;
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
extern int pid_cycle, pid_number_of_cycles; extern int pid_cycle, pid_number_of_cycles;
extern float Kp,Ki,Kd,Kc,_Kp,_Ki,_Kd; extern float Kp,Ki,Kd,Kc,_Kp,_Ki,_Kd;
extern bool pid_tuning_finished; extern bool pid_tuning_finished;
float scalePID_i(float i); float scalePID_i(float i);
float scalePID_d(float d); float scalePID_d(float d);
float unscalePID_i(float i); float unscalePID_i(float i);
float unscalePID_d(float d); float unscalePID_d(float d);
#endif #endif
#ifdef PIDTEMPBED #ifdef PIDTEMPBED
extern float bedKp,bedKi,bedKd; extern float bedKp,bedKi,bedKd;
#endif #endif
#ifdef BABYSTEPPING #ifdef BABYSTEPPING
extern volatile int babystepsTodo[3]; extern volatile int babystepsTodo[3];
#endif #endif
inline void babystepsTodoZadd(int n) inline void babystepsTodoZadd(int n)
{ {
if (n != 0) { if (n != 0) {
CRITICAL_SECTION_START CRITICAL_SECTION_START
babystepsTodo[Z_AXIS] += n; babystepsTodo[Z_AXIS] += n;
CRITICAL_SECTION_END CRITICAL_SECTION_END
} }
} }
inline void babystepsTodoZsubtract(int n) inline void babystepsTodoZsubtract(int n)
{ {
if (n != 0) { if (n != 0) {
CRITICAL_SECTION_START CRITICAL_SECTION_START
babystepsTodo[Z_AXIS] -= n; babystepsTodo[Z_AXIS] -= n;
CRITICAL_SECTION_END CRITICAL_SECTION_END
} }
} }
//high level conversion routines, for use outside of temperature.cpp //high level conversion routines, for use outside of temperature.cpp
//inline so that there is no performance decrease. //inline so that there is no performance decrease.
//deg=degreeCelsius //deg=degreeCelsius
FORCE_INLINE float degHotend(uint8_t extruder) { FORCE_INLINE float degHotend(uint8_t extruder) {
return current_temperature[extruder]; return current_temperature[extruder];
}; };
#ifdef SHOW_TEMP_ADC_VALUES #ifdef SHOW_TEMP_ADC_VALUES
FORCE_INLINE float rawHotendTemp(uint8_t extruder) { FORCE_INLINE float rawHotendTemp(uint8_t extruder) {
return current_temperature_raw[extruder]; return current_temperature_raw[extruder];
}; };
FORCE_INLINE float rawBedTemp() { FORCE_INLINE float rawBedTemp() {
return current_temperature_bed_raw; return current_temperature_bed_raw;
}; };
#endif #endif
FORCE_INLINE float degBed() { FORCE_INLINE float degBed() {
return current_temperature_bed; return current_temperature_bed;
}; };
FORCE_INLINE float degTargetHotend(uint8_t extruder) { FORCE_INLINE float degTargetHotend(uint8_t extruder) {
return target_temperature[extruder]; return target_temperature[extruder];
}; };
FORCE_INLINE float degTargetBed() { FORCE_INLINE float degTargetBed() {
return target_temperature_bed; return target_temperature_bed;
}; };
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
target_temperature[extruder] = celsius; target_temperature[extruder] = celsius;
}; };
FORCE_INLINE void setTargetBed(const float &celsius) { FORCE_INLINE void setTargetBed(const float &celsius) {
target_temperature_bed = celsius; target_temperature_bed = celsius;
}; };
FORCE_INLINE bool isHeatingHotend(uint8_t extruder){ FORCE_INLINE bool isHeatingHotend(uint8_t extruder){
return target_temperature[extruder] > current_temperature[extruder]; return target_temperature[extruder] > current_temperature[extruder];
}; };
FORCE_INLINE bool isHeatingBed() { FORCE_INLINE bool isHeatingBed() {
return target_temperature_bed > current_temperature_bed; return target_temperature_bed > current_temperature_bed;
}; };
FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { FORCE_INLINE bool isCoolingHotend(uint8_t extruder) {
return target_temperature[extruder] < current_temperature[extruder]; return target_temperature[extruder] < current_temperature[extruder];
}; };
FORCE_INLINE bool isCoolingBed() { FORCE_INLINE bool isCoolingBed() {
return target_temperature_bed < current_temperature_bed; return target_temperature_bed < current_temperature_bed;
}; };
#define degHotend0() degHotend(0) #define degHotend0() degHotend(0)
#define degTargetHotend0() degTargetHotend(0) #define degTargetHotend0() degTargetHotend(0)
#define setTargetHotend0(_celsius) setTargetHotend((_celsius), 0) #define setTargetHotend0(_celsius) setTargetHotend((_celsius), 0)
#define isHeatingHotend0() isHeatingHotend(0) #define isHeatingHotend0() isHeatingHotend(0)
#define isCoolingHotend0() isCoolingHotend(0) #define isCoolingHotend0() isCoolingHotend(0)
#if EXTRUDERS > 1 #if EXTRUDERS > 1
#define degHotend1() degHotend(1) #define degHotend1() degHotend(1)
#define degTargetHotend1() degTargetHotend(1) #define degTargetHotend1() degTargetHotend(1)
#define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1) #define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1)
#define isHeatingHotend1() isHeatingHotend(1) #define isHeatingHotend1() isHeatingHotend(1)
#define isCoolingHotend1() isCoolingHotend(1) #define isCoolingHotend1() isCoolingHotend(1)
#else #else
#define setTargetHotend1(_celsius) do{}while(0) #define setTargetHotend1(_celsius) do{}while(0)
#endif #endif
#if EXTRUDERS > 2 #if EXTRUDERS > 2
#define degHotend2() degHotend(2) #define degHotend2() degHotend(2)
#define degTargetHotend2() degTargetHotend(2) #define degTargetHotend2() degTargetHotend(2)
#define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2) #define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2)
#define isHeatingHotend2() isHeatingHotend(2) #define isHeatingHotend2() isHeatingHotend(2)
#define isCoolingHotend2() isCoolingHotend(2) #define isCoolingHotend2() isCoolingHotend(2)
#else #else
#define setTargetHotend2(_celsius) do{}while(0) #define setTargetHotend2(_celsius) do{}while(0)
#endif #endif
#if EXTRUDERS > 3 #if EXTRUDERS > 3
#error Invalid number of extruders #error Invalid number of extruders
#endif #endif
#if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) #if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0)
static float temp_runaway_status[4]; static float temp_runaway_status[4];
static float temp_runaway_target[4]; static float temp_runaway_target[4];
static float temp_runaway_timer[4]; static float temp_runaway_timer[4];
static int temp_runaway_error_counter[4]; static int temp_runaway_error_counter[4];
void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed); void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed);
void temp_runaway_stop(bool isPreheat, bool isBed); void temp_runaway_stop(bool isPreheat, bool isBed);
#endif #endif
int getHeaterPower(int heater); int getHeaterPower(int heater);
void disable_heater(); void disable_heater();
void setWatch(); void setWatch();
void updatePID(); void updatePID();
FORCE_INLINE void autotempShutdown(){ FORCE_INLINE void autotempShutdown(){
#ifdef AUTOTEMP #ifdef AUTOTEMP
if(autotemp_enabled) if(autotemp_enabled)
{ {
autotemp_enabled=false; autotemp_enabled=false;
if(degTargetHotend(active_extruder)>autotemp_min) if(degTargetHotend(active_extruder)>autotemp_min)
setTargetHotend(0,active_extruder); setTargetHotend(0,active_extruder);
} }
#endif #endif
} }
void PID_autotune(float temp, int extruder, int ncycles); void PID_autotune(float temp, int extruder, int ncycles);
void setExtruderAutoFanState(int pin, bool state); void setExtruderAutoFanState(int pin, bool state);
void checkExtruderAutoFans(); void checkExtruderAutoFans();
#endif #endif

View File

@ -640,7 +640,7 @@ void lcd_commands()
#endif #endif
lcd_ignore_click(false); lcd_ignore_click(false);
#ifdef SNMM #ifdef SNMM
lcd_commands_step = 7; lcd_commands_step = 8;
#else #else
lcd_commands_step = 3; lcd_commands_step = 3;
#endif #endif
@ -671,9 +671,17 @@ void lcd_commands()
lcd_commands_step = 5; lcd_commands_step = 5;
} }
if (lcd_commands_step == 7 && !blocks_queued()) { if (lcd_commands_step == 7 && !blocks_queued()) {
enquecommand_P(PSTR("M702")); switch(snmm_stop_print_menu()) {
case 0: enquecommand_P(PSTR("M702")); break;//all
case 1: enquecommand_P(PSTR("M702 U")); break; //used
case 2: enquecommand_P(PSTR("M702 C")); break; //current
default: enquecommand_P(PSTR("M702")); break;
}
lcd_commands_step = 3; lcd_commands_step = 3;
} }
if (lcd_commands_step == 8 && !blocks_queued()) { //step 8 is here for delay (going to next step after execution of all gcodes from step 4)
lcd_commands_step = 7;
}
} }
if (lcd_commands_type == 3) if (lcd_commands_type == 3)
@ -931,6 +939,8 @@ static void lcd_support_menu()
MENU_ITEM(back, PSTR("FlashAir IP Addr:"), lcd_main_menu); MENU_ITEM(back, PSTR("FlashAir IP Addr:"), lcd_main_menu);
MENU_ITEM(back_RAM, menuData.supportMenu.ip_str, lcd_main_menu); MENU_ITEM(back_RAM, menuData.supportMenu.ip_str, lcd_main_menu);
} }
MENU_ITEM(back, PSTR("------------"), lcd_main_menu);
MENU_ITEM(function, PSTR("XYZ cal. details"), lcd_service_mode_show_result);
END_MENU(); END_MENU();
} }
@ -1336,6 +1346,57 @@ static void lcd_move_e()
} }
} }
void lcd_service_mode_show_result() {
lcd_set_custom_characters_degree();
count_xyz_details();
lcd_update_enable(false);
lcd_implementation_clear();
lcd_printPGM(PSTR("Y distance from min:"));
lcd_print_at_PGM(0, 1, PSTR("Left:"));
lcd_print_at_PGM(0, 2, PSTR("Center:"));
lcd_print_at_PGM(0, 3, PSTR("Right:"));
for (int i = 0; i < 3; i++) {
if(distance_from_min[i] < 200) {
lcd_print_at_PGM(8, i + 1, PSTR(""));
lcd.print(distance_from_min[i]);
lcd_print_at_PGM((distance_from_min[i] < 0) ? 14 : 13, i + 1, PSTR("mm"));
} else lcd_print_at_PGM(8, i + 1, PSTR("N/A"));
}
delay_keep_alive(500);
while (!lcd_clicked()) {
delay_keep_alive(100);
}
delay_keep_alive(500);
lcd_implementation_clear();
lcd_printPGM(PSTR("Angle diff: "));
if (angleDiff < 100) {
lcd.print(angleDiff * 180 / M_PI);
lcd.print(LCD_STR_DEGREE);
}else lcd_print_at_PGM(12, 0, PSTR("N/A"));
lcd_print_at_PGM(0, 1, PSTR("--------------------"));
lcd_print_at_PGM(0, 2, PSTR("Mild:"));
lcd_print_at_PGM(12, 2, PSTR(""));
lcd.print(bed_skew_angle_mild * 180 / M_PI);
lcd.print(LCD_STR_DEGREE);
lcd_print_at_PGM(0, 3, PSTR("Extreme:"));
lcd_print_at_PGM(12, 3, PSTR(""));
lcd.print(bed_skew_angle_extreme * 180 / M_PI);
lcd.print(LCD_STR_DEGREE);
delay_keep_alive(500);
while (!lcd_clicked()) {
delay_keep_alive(100);
}
delay_keep_alive(500);
lcd_set_custom_characters_arrows();
lcd_return_to_status();
lcd_update_enable(true);
lcd_update(2);
}
// Save a single axis babystep value. // Save a single axis babystep value.
void EEPROM_save_B(int pos, int* value) void EEPROM_save_B(int pos, int* value)
@ -2890,6 +2951,138 @@ void bowden_menu() {
} }
} }
static char snmm_stop_print_menu() { //menu for choosing which filaments will be unloaded in stop print
lcd_implementation_clear();
lcd_print_at_PGM(0,0,MSG_UNLOAD_FILAMENT); lcd.print(":");
lcd.setCursor(0, 1); lcd.print(">");
lcd_print_at_PGM(1,1,MSG_ALL);
lcd_print_at_PGM(1,2,MSG_USED);
lcd_print_at_PGM(1,3,MSG_CURRENT);
char cursor_pos = 1;
int enc_dif = 0;
while (1) {
manage_heater();
manage_inactivity(true);
if (abs((enc_dif - encoderDiff)) > 4) {
if ((abs(enc_dif - encoderDiff)) > 1) {
if (enc_dif > encoderDiff) cursor_pos--;
if (enc_dif < encoderDiff) cursor_pos++;
if (cursor_pos > 3) cursor_pos = 3;
if (cursor_pos < 1) cursor_pos = 1;
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 2);
lcd.print(" ");
lcd.setCursor(0, 3);
lcd.print(" ");
lcd.setCursor(0, cursor_pos);
lcd.print(">");
enc_dif = encoderDiff;
delay(100);
}
}
if (lcd_clicked()) {
while (lcd_clicked());
delay(10);
while (lcd_clicked());
return(cursor_pos - 1);
}
}
}
char choose_extruder_menu() {
int items_no = 4;
int first = 0;
int enc_dif = 0;
char cursor_pos = 1;
enc_dif = encoderDiff;
lcd_implementation_clear();
lcd_printPGM(MSG_CHOOSE_EXTRUDER);
lcd.setCursor(0, 1);
lcd.print(">");
for (int i = 0; i < 3; i++) {
lcd_print_at_PGM(1, i + 1, MSG_EXTRUDER);
}
while (1) {
for (int i = 0; i < 3; i++) {
lcd.setCursor(2 + strlen_P(MSG_EXTRUDER), i+1);
lcd.print(first + i + 1);
}
manage_heater();
manage_inactivity(true);
if (abs((enc_dif - encoderDiff)) > 4) {
if ((abs(enc_dif - encoderDiff)) > 1) {
if (enc_dif > encoderDiff) {
cursor_pos--;
}
if (enc_dif < encoderDiff) {
cursor_pos++;
}
if (cursor_pos > 3) {
cursor_pos = 3;
if (first < items_no - 3) {
first++;
lcd_implementation_clear();
lcd_printPGM(MSG_CHOOSE_EXTRUDER);
for (int i = 0; i < 3; i++) {
lcd_print_at_PGM(1, i + 1, MSG_EXTRUDER);
}
}
}
if (cursor_pos < 1) {
cursor_pos = 1;
if (first > 0) {
first--;
lcd_implementation_clear();
lcd_printPGM(MSG_CHOOSE_EXTRUDER);
for (int i = 0; i < 3; i++) {
lcd_print_at_PGM(1, i + 1, MSG_EXTRUDER);
}
}
}
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 2);
lcd.print(" ");
lcd.setCursor(0, 3);
lcd.print(" ");
lcd.setCursor(0, cursor_pos);
lcd.print(">");
enc_dif = encoderDiff;
delay(100);
}
}
if (lcd_clicked()) {
lcd_update(2);
while (lcd_clicked());
delay(10);
while (lcd_clicked());
return(cursor_pos + first - 1);
}
}
}
char reset_menu() { char reset_menu() {
#ifdef SNMM #ifdef SNMM
int items_no = 5; int items_no = 5;
@ -3116,7 +3309,7 @@ static void extr_adj(int extruder) //loading filament for SNMM
} }
static void extr_unload() { //unloads filament void extr_unload() { //unloads filament
float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT; float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT;
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
int8_t SilentMode; int8_t SilentMode;
@ -3254,6 +3447,30 @@ void extr_unload_all() {
} }
} }
//unloading just used filament (for snmm)
void extr_unload_used() {
if (degHotend0() > EXTRUDE_MINTEMP) {
for (int i = 0; i < 4; i++) {
if (snmm_filaments_used & (1 << i)) {
change_extr(i);
extr_unload();
}
}
snmm_filaments_used = 0;
}
else {
lcd_implementation_clear();
lcd.setCursor(0, 0);
lcd_printPGM(MSG_ERROR);
lcd.setCursor(0, 2);
lcd_printPGM(MSG_PREHEAT_NOZZLE);
delay(2000);
lcd_implementation_clear();
lcd_return_to_status();
}
}
static void extr_unload_0() { static void extr_unload_0() {
@ -3287,7 +3504,6 @@ static void fil_load_menu()
END_MENU(); END_MENU();
} }
static void fil_unload_menu() static void fil_unload_menu()
{ {
START_MENU(); START_MENU();
@ -3304,10 +3520,10 @@ static void fil_unload_menu()
static void change_extr_menu(){ static void change_extr_menu(){
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu); MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM(function, PSTR("Extruder 1"), extr_change_0); MENU_ITEM(function, MSG_EXTRUDER_1, extr_change_0);
MENU_ITEM(function, PSTR("Extruder 2"), extr_change_1); MENU_ITEM(function, MSG_EXTRUDER_2, extr_change_1);
MENU_ITEM(function, PSTR("Extruder 3"), extr_change_2); MENU_ITEM(function, MSG_EXTRUDER_3, extr_change_2);
MENU_ITEM(function, PSTR("Extruder 4"), extr_change_3); MENU_ITEM(function, MSG_EXTRUDER_4, extr_change_3);
END_MENU(); END_MENU();
} }
@ -4047,7 +4263,7 @@ static void lcd_selftest()
} }
if (_result) if (_result)
{ {
_progress = lcd_selftest_screen(5, _progress, 3, true, 2000); _progress = lcd_selftest_screen(5, _progress, 3, true, 2000);
_result = lcd_selfcheck_check_heater(true); _result = lcd_selfcheck_check_heater(true);
} }
@ -4244,10 +4460,11 @@ static bool lcd_selfcheck_endstops()
if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1 || READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1 || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1 || READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1 || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1)
{ {
_result = false; _result = false;
String _error = String((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? "X" : "") + char _error[4] = "";
String((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) ? "Y" : "") + if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "X");
String((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? "Z" : ""); if (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Y");
lcd_selftest_error(3, _error.c_str(), ""); if (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Z");
lcd_selftest_error(3, _error, "");
} }
manage_heater(); manage_heater();
manage_inactivity(true); manage_inactivity(true);
@ -4263,9 +4480,9 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
int _checked_snapshot = (_isbed) ? degBed() : degHotend(0); int _checked_snapshot = (_isbed) ? degBed() : degHotend(0);
int _opposite_snapshot = (_isbed) ? degHotend(0) : degBed(); int _opposite_snapshot = (_isbed) ? degHotend(0) : degBed();
int _cycles = (_isbed) ? 120 : 30; int _cycles = (_isbed) ? 180 : 60; //~ 90s / 30s
target_temperature[0] = (_isbed) ? 0 : 100; target_temperature[0] = (_isbed) ? 0 : 200;
target_temperature_bed = (_isbed) ? 100 : 0; target_temperature_bed = (_isbed) ? 100 : 0;
manage_heater(); manage_heater();
manage_inactivity(true); manage_inactivity(true);
@ -4277,8 +4494,16 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
manage_heater(); manage_heater();
manage_inactivity(true); manage_inactivity(true);
_progress = (_isbed) ? lcd_selftest_screen(5, _progress, 2, false, 400) : lcd_selftest_screen(1, _progress, 2, false, 400); _progress = (_isbed) ? lcd_selftest_screen(5, _progress, 2, false, 400) : lcd_selftest_screen(1, _progress, 2, false, 400);
/*if (_isbed) {
MYSERIAL.print("Bed temp:");
MYSERIAL.println(degBed());
}
else {
MYSERIAL.print("Hotend temp:");
MYSERIAL.println(degHotend(0));
}*/
} while (_docycle); } while (_docycle);
target_temperature[0] = 0; target_temperature[0] = 0;
target_temperature_bed = 0; target_temperature_bed = 0;
@ -4286,7 +4511,13 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
int _checked_result = (_isbed) ? degBed() - _checked_snapshot : degHotend(0) - _checked_snapshot; int _checked_result = (_isbed) ? degBed() - _checked_snapshot : degHotend(0) - _checked_snapshot;
int _opposite_result = (_isbed) ? degHotend(0) - _opposite_snapshot : degBed() - _opposite_snapshot; int _opposite_result = (_isbed) ? degHotend(0) - _opposite_snapshot : degBed() - _opposite_snapshot;
/*
MYSERIAL.println("");
MYSERIAL.print("Checked result:");
MYSERIAL.println(_checked_result);
MYSERIAL.print("Opposite result:");
MYSERIAL.println(_opposite_result);
*/
if (_opposite_result < ((_isbed) ? 10 : 3)) if (_opposite_result < ((_isbed) ? 10 : 3))
{ {
if (_checked_result >= ((_isbed) ? 3 : 10)) if (_checked_result >= ((_isbed) ? 3 : 10))

View File

@ -222,8 +222,10 @@ static void extr_unload_1();
static void extr_unload_2(); static void extr_unload_2();
static void extr_unload_3(); static void extr_unload_3();
static void lcd_disable_farm_mode(); static void lcd_disable_farm_mode();
void extr_unload_all(); void extr_unload_all();
static void extr_unload(); void extr_unload_used();
void extr_unload();
static char snmm_stop_print_menu();
void stack_error(); void stack_error();
static void lcd_ping_allert(); static void lcd_ping_allert();
@ -246,6 +248,7 @@ union MenuData;
void bowden_menu(); void bowden_menu();
char reset_menu(); char reset_menu();
char choose_extruder_menu();
void lcd_pinda_calibration_menu(); void lcd_pinda_calibration_menu();
void lcd_calibrate_pinda(); void lcd_calibrate_pinda();
@ -253,4 +256,6 @@ void lcd_temp_calibration_set();
void display_loading(); void display_loading();
void lcd_service_mode_show_result();
#endif //ULTRALCD_H #endif //ULTRALCD_H

View File

@ -1,288 +1,288 @@
#include "Configuration.h" #include "Configuration.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "language.h" #include "language.h"
#include "util.h" #include "util.h"
// Allocate the version string in the program memory. Otherwise the string lands either on the stack or in the global RAM. // Allocate the version string in the program memory. Otherwise the string lands either on the stack or in the global RAM.
const char FW_VERSION_STR[] PROGMEM = FW_version; const char FW_VERSION_STR[] PROGMEM = FW_version;
const char* FW_VERSION_STR_P() const char* FW_VERSION_STR_P()
{ {
return FW_VERSION_STR; return FW_VERSION_STR;
} }
const char FW_PRUSA3D_MAGIC_STR[] PROGMEM = FW_PRUSA3D_MAGIC; const char FW_PRUSA3D_MAGIC_STR[] PROGMEM = FW_PRUSA3D_MAGIC;
const char* FW_PRUSA3D_MAGIC_STR_P() const char* FW_PRUSA3D_MAGIC_STR_P()
{ {
return FW_PRUSA3D_MAGIC_STR; return FW_PRUSA3D_MAGIC_STR;
} }
const char STR_REVISION_DEV [] PROGMEM = "dev"; const char STR_REVISION_DEV [] PROGMEM = "dev";
const char STR_REVISION_ALPHA[] PROGMEM = "alpha"; const char STR_REVISION_ALPHA[] PROGMEM = "alpha";
const char STR_REVISION_BETA [] PROGMEM = "beta"; const char STR_REVISION_BETA [] PROGMEM = "beta";
const char STR_REVISION_RC [] PROGMEM = "rc"; const char STR_REVISION_RC [] PROGMEM = "rc";
inline bool is_whitespace_or_nl(char c) inline bool is_whitespace_or_nl(char c)
{ {
return c == ' ' || c == '\t' || c == '\n' || c == 'r'; return c == ' ' || c == '\t' || c == '\n' || c == 'r';
} }
inline bool is_whitespace_or_nl_or_eol(char c) inline bool is_whitespace_or_nl_or_eol(char c)
{ {
return c == 0 || c == ' ' || c == '\t' || c == '\n' || c == '\r'; return c == 0 || c == ' ' || c == '\t' || c == '\n' || c == '\r';
} }
inline bool is_digit(char c) inline bool is_digit(char c)
{ {
return c >= '0' && c <= '9'; return c >= '0' && c <= '9';
} }
// Parse a major.minor.revision version number. // Parse a major.minor.revision version number.
// Return true if valid. // Return true if valid.
inline bool parse_version(const char *str, uint16_t version[4]) inline bool parse_version(const char *str, uint16_t version[4])
{ {
#if 0 #if 0
SERIAL_ECHOPGM("Parsing version string "); SERIAL_ECHOPGM("Parsing version string ");
SERIAL_ECHO(str); SERIAL_ECHO(str);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
#endif #endif
const char *major = str; const char *major = str;
const char *p = str; const char *p = str;
while (is_digit(*p)) ++ p; while (is_digit(*p)) ++ p;
if (*p != '.') if (*p != '.')
return false; return false;
const char *minor = ++ p; const char *minor = ++ p;
while (is_digit(*p)) ++ p; while (is_digit(*p)) ++ p;
if (*p != '.') if (*p != '.')
return false; return false;
const char *rev = ++ p; const char *rev = ++ p;
while (is_digit(*p)) ++ p; while (is_digit(*p)) ++ p;
if (! is_whitespace_or_nl_or_eol(*p) && *p != '-') if (! is_whitespace_or_nl_or_eol(*p) && *p != '-')
return false; return false;
char *endptr = NULL; char *endptr = NULL;
version[0] = strtol(major, &endptr, 10); version[0] = strtol(major, &endptr, 10);
if (endptr != minor - 1) if (endptr != minor - 1)
return false; return false;
version[1] = strtol(minor, &endptr, 10); version[1] = strtol(minor, &endptr, 10);
if (endptr != rev - 1) if (endptr != rev - 1)
return false; return false;
version[2] = strtol(rev, &endptr, 10); version[2] = strtol(rev, &endptr, 10);
if (endptr != p) if (endptr != p)
return false; return false;
version[3] = FIRMWARE_REVISION_RELEASED; version[3] = FIRMWARE_REVISION_RELEASED;
if (*p ++ == '-') { if (*p ++ == '-') {
const char *q = p; const char *q = p;
while (! is_whitespace_or_nl_or_eol(*q)) while (! is_whitespace_or_nl_or_eol(*q))
++ q; ++ q;
uint8_t n = q - p; uint8_t n = q - p;
if (n == strlen_P(STR_REVISION_DEV) && strncmp_P(p, STR_REVISION_DEV, n) == 0) if (n == strlen_P(STR_REVISION_DEV) && strncmp_P(p, STR_REVISION_DEV, n) == 0)
version[3] = FIRMWARE_REVISION_DEV; version[3] = FIRMWARE_REVISION_DEV;
else if (n == strlen_P(STR_REVISION_ALPHA) && strncmp_P(p, STR_REVISION_ALPHA, n) == 0) else if (n == strlen_P(STR_REVISION_ALPHA) && strncmp_P(p, STR_REVISION_ALPHA, n) == 0)
version[3] = FIRMWARE_REVISION_ALPHA; version[3] = FIRMWARE_REVISION_ALPHA;
else if (n == strlen_P(STR_REVISION_BETA) && strncmp_P(p, STR_REVISION_BETA, n) == 0) else if (n == strlen_P(STR_REVISION_BETA) && strncmp_P(p, STR_REVISION_BETA, n) == 0)
version[3] = FIRMWARE_REVISION_BETA; version[3] = FIRMWARE_REVISION_BETA;
else if ((n == 2 || n == 3) && p[0] == 'r' && p[1] == 'c') { else if ((n == 2 || n == 3) && p[0] == 'r' && p[1] == 'c') {
if (n == 2) if (n == 2)
version[3] = FIRMWARE_REVISION_RC; version[3] = FIRMWARE_REVISION_RC;
else { else {
if (is_digit(p[2])) if (is_digit(p[2]))
version[3] = FIRMWARE_REVISION_RC + p[2] - '1'; version[3] = FIRMWARE_REVISION_RC + p[2] - '1';
else else
return false; return false;
} }
} else } else
return false; return false;
} }
#if 0 #if 0
SERIAL_ECHOPGM("Version parsed, major: "); SERIAL_ECHOPGM("Version parsed, major: ");
SERIAL_ECHO(version[0]); SERIAL_ECHO(version[0]);
SERIAL_ECHOPGM(", minor: "); SERIAL_ECHOPGM(", minor: ");
SERIAL_ECHO(version[1]); SERIAL_ECHO(version[1]);
SERIAL_ECHOPGM(", revision: "); SERIAL_ECHOPGM(", revision: ");
SERIAL_ECHO(version[2]); SERIAL_ECHO(version[2]);
SERIAL_ECHOPGM(", flavor: "); SERIAL_ECHOPGM(", flavor: ");
SERIAL_ECHO(version[3]); SERIAL_ECHO(version[3]);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
#endif #endif
return true; return true;
} }
inline bool strncmp_PP(const char *p1, const char *p2, uint8_t n) inline bool strncmp_PP(const char *p1, const char *p2, uint8_t n)
{ {
for (; n > 0; -- n, ++ p1, ++ p2) { for (; n > 0; -- n, ++ p1, ++ p2) {
if (pgm_read_byte(p1) < pgm_read_byte(p2)) if (pgm_read_byte(p1) < pgm_read_byte(p2))
return -1; return -1;
if (pgm_read_byte(p1) > pgm_read_byte(p2)) if (pgm_read_byte(p1) > pgm_read_byte(p2))
return 1; return 1;
if (pgm_read_byte(p1) == 0) if (pgm_read_byte(p1) == 0)
return 0; return 0;
} }
return 0; return 0;
} }
// Parse a major.minor.revision version number. // Parse a major.minor.revision version number.
// Return true if valid. // Return true if valid.
inline bool parse_version_P(const char *str, uint16_t version[4]) inline bool parse_version_P(const char *str, uint16_t version[4])
{ {
#if 0 #if 0
SERIAL_ECHOPGM("Parsing version string "); SERIAL_ECHOPGM("Parsing version string ");
SERIAL_ECHORPGM(str); SERIAL_ECHORPGM(str);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
#endif #endif
const char *major = str; const char *major = str;
const char *p = str; const char *p = str;
while (is_digit(char(pgm_read_byte(p)))) ++ p; while (is_digit(char(pgm_read_byte(p)))) ++ p;
if (pgm_read_byte(p) != '.') if (pgm_read_byte(p) != '.')
return false; return false;
const char *minor = ++ p; const char *minor = ++ p;
while (is_digit(char(pgm_read_byte(p)))) ++ p; while (is_digit(char(pgm_read_byte(p)))) ++ p;
if (pgm_read_byte(p) != '.') if (pgm_read_byte(p) != '.')
return false; return false;
const char *rev = ++ p; const char *rev = ++ p;
while (is_digit(char(pgm_read_byte(p)))) ++ p; while (is_digit(char(pgm_read_byte(p)))) ++ p;
if (! is_whitespace_or_nl_or_eol(char(pgm_read_byte(p))) && pgm_read_byte(p) != '-') if (! is_whitespace_or_nl_or_eol(char(pgm_read_byte(p))) && pgm_read_byte(p) != '-')
return false; return false;
char buf[5]; char buf[5];
uint8_t n = minor - major - 1; uint8_t n = minor - major - 1;
if (n > 4) if (n > 4)
return false; return false;
memcpy_P(buf, major, n); buf[n] = 0; memcpy_P(buf, major, n); buf[n] = 0;
char *endptr = NULL; char *endptr = NULL;
version[0] = strtol(buf, &endptr, 10); version[0] = strtol(buf, &endptr, 10);
if (*endptr != 0) if (*endptr != 0)
return false; return false;
n = rev - minor - 1; n = rev - minor - 1;
if (n > 4) if (n > 4)
return false; return false;
memcpy_P(buf, minor, n); buf[n] = 0; memcpy_P(buf, minor, n); buf[n] = 0;
version[1] = strtol(buf, &endptr, 10); version[1] = strtol(buf, &endptr, 10);
if (*endptr != 0) if (*endptr != 0)
return false; return false;
n = p - rev; n = p - rev;
if (n > 4) if (n > 4)
return false; return false;
memcpy_P(buf, rev, n); memcpy_P(buf, rev, n);
buf[n] = 0; buf[n] = 0;
version[2] = strtol(buf, &endptr, 10); version[2] = strtol(buf, &endptr, 10);
if (*endptr != 0) if (*endptr != 0)
return false; return false;
version[3] = FIRMWARE_REVISION_RELEASED; version[3] = FIRMWARE_REVISION_RELEASED;
if (pgm_read_byte(p ++) == '-') { if (pgm_read_byte(p ++) == '-') {
const char *q = p; const char *q = p;
while (! is_whitespace_or_nl_or_eol(char(pgm_read_byte(q)))) while (! is_whitespace_or_nl_or_eol(char(pgm_read_byte(q))))
++ q; ++ q;
n = q - p; n = q - p;
if (n == strlen_P(STR_REVISION_DEV) && strncmp_PP(p, STR_REVISION_DEV, n) == 0) if (n == strlen_P(STR_REVISION_DEV) && strncmp_PP(p, STR_REVISION_DEV, n) == 0)
version[3] = FIRMWARE_REVISION_DEV; version[3] = FIRMWARE_REVISION_DEV;
else if (n == strlen_P(STR_REVISION_ALPHA) && strncmp_PP(p, STR_REVISION_ALPHA, n) == 0) else if (n == strlen_P(STR_REVISION_ALPHA) && strncmp_PP(p, STR_REVISION_ALPHA, n) == 0)
version[3] = FIRMWARE_REVISION_ALPHA; version[3] = FIRMWARE_REVISION_ALPHA;
else if (n == strlen_P(STR_REVISION_BETA) && strncmp_PP(p, STR_REVISION_BETA, n) == 0) else if (n == strlen_P(STR_REVISION_BETA) && strncmp_PP(p, STR_REVISION_BETA, n) == 0)
version[3] = FIRMWARE_REVISION_BETA; version[3] = FIRMWARE_REVISION_BETA;
else if ((n == 2 || n == 3) && strncmp_PP(p, STR_REVISION_RC, 2) == 0) { else if ((n == 2 || n == 3) && strncmp_PP(p, STR_REVISION_RC, 2) == 0) {
if (n == 2) if (n == 2)
version[3] = FIRMWARE_REVISION_RC; version[3] = FIRMWARE_REVISION_RC;
else { else {
p += 2; p += 2;
if (is_digit(pgm_read_byte(p))) if (is_digit(pgm_read_byte(p)))
version[3] = FIRMWARE_REVISION_RC + pgm_read_byte(p) - '1'; version[3] = FIRMWARE_REVISION_RC + pgm_read_byte(p) - '1';
else else
return false; return false;
} }
} else } else
return false; return false;
} }
#if 0 #if 0
SERIAL_ECHOPGM("Version parsed, major: "); SERIAL_ECHOPGM("Version parsed, major: ");
SERIAL_ECHO(version[0]); SERIAL_ECHO(version[0]);
SERIAL_ECHOPGM(", minor: "); SERIAL_ECHOPGM(", minor: ");
SERIAL_ECHO(version[1]); SERIAL_ECHO(version[1]);
SERIAL_ECHOPGM(", revision: "); SERIAL_ECHOPGM(", revision: ");
SERIAL_ECHO(version[2]); SERIAL_ECHO(version[2]);
SERIAL_ECHOPGM(", flavor: "); SERIAL_ECHOPGM(", flavor: ");
SERIAL_ECHO(version[3]); SERIAL_ECHO(version[3]);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
#endif #endif
return true; return true;
} }
// 1 - yes, 0 - false, -1 - error; // 1 - yes, 0 - false, -1 - error;
inline int8_t is_provided_version_newer(const char *version_string) inline int8_t is_provided_version_newer(const char *version_string)
{ {
uint16_t ver_gcode[3], ver_current[3]; uint16_t ver_gcode[3], ver_current[3];
if (! parse_version(version_string, ver_gcode)) if (! parse_version(version_string, ver_gcode))
return -1; return -1;
if (! parse_version_P(FW_VERSION_STR, ver_current)) if (! parse_version_P(FW_VERSION_STR, ver_current))
return 0; // this shall not happen return 0; // this shall not happen
for (uint8_t i = 0; i < 3; ++ i) for (uint8_t i = 0; i < 3; ++ i)
if (ver_gcode[i] > ver_current[i]) if (ver_gcode[i] > ver_current[i])
return 1; return 1;
return 0; return 0;
} }
bool show_upgrade_dialog_if_version_newer(const char *version_string) bool show_upgrade_dialog_if_version_newer(const char *version_string)
{ {
uint16_t ver_gcode[4], ver_current[4]; uint16_t ver_gcode[4], ver_current[4];
if (! parse_version(version_string, ver_gcode)) { if (! parse_version(version_string, ver_gcode)) {
// SERIAL_PROTOCOLLNPGM("parse_version failed"); // SERIAL_PROTOCOLLNPGM("parse_version failed");
return false; return false;
} }
if (! parse_version_P(FW_VERSION_STR, ver_current)) { if (! parse_version_P(FW_VERSION_STR, ver_current)) {
// SERIAL_PROTOCOLLNPGM("parse_version_P failed"); // SERIAL_PROTOCOLLNPGM("parse_version_P failed");
return false; // this shall not happen return false; // this shall not happen
} }
// SERIAL_PROTOCOLLNPGM("versions parsed"); // SERIAL_PROTOCOLLNPGM("versions parsed");
bool upgrade = false; bool upgrade = false;
for (uint8_t i = 0; i < 4; ++ i) { for (uint8_t i = 0; i < 4; ++ i) {
if (ver_gcode[i] > ver_current[i]) { if (ver_gcode[i] > ver_current[i]) {
upgrade = true; upgrade = true;
break; break;
} else if (ver_gcode[i] < ver_current[i]) } else if (ver_gcode[i] < ver_current[i])
break; break;
} }
if (upgrade) { if (upgrade) {
lcd_display_message_fullscreen_P(MSG_NEW_FIRMWARE_AVAILABLE); lcd_display_message_fullscreen_P(MSG_NEW_FIRMWARE_AVAILABLE);
lcd_print_at_PGM(0, 2, PSTR("")); lcd_print_at_PGM(0, 2, PSTR(""));
for (const char *c = version_string; ! is_whitespace_or_nl_or_eol(*c); ++ c) for (const char *c = version_string; ! is_whitespace_or_nl_or_eol(*c); ++ c)
lcd_implementation_write(*c); lcd_implementation_write(*c);
lcd_print_at_PGM(0, 3, MSG_NEW_FIRMWARE_PLEASE_UPGRADE); lcd_print_at_PGM(0, 3, MSG_NEW_FIRMWARE_PLEASE_UPGRADE);
tone(BEEPER, 1000); tone(BEEPER, 1000);
delay_keep_alive(50); delay_keep_alive(50);
noTone(BEEPER); noTone(BEEPER);
delay_keep_alive(500); delay_keep_alive(500);
tone(BEEPER, 1000); tone(BEEPER, 1000);
delay_keep_alive(50); delay_keep_alive(50);
noTone(BEEPER); noTone(BEEPER);
lcd_wait_for_click(); lcd_wait_for_click();
lcd_update_enable(true); lcd_update_enable(true);
lcd_implementation_clear(); lcd_implementation_clear();
lcd_update(); lcd_update();
} }
// Succeeded. // Succeeded.
return true; return true;
} }
void update_current_firmware_version_to_eeprom() void update_current_firmware_version_to_eeprom()
{ {
for (int8_t i = 0; i < FW_PRUSA3D_MAGIC_LEN; ++ i) for (int8_t i = 0; i < FW_PRUSA3D_MAGIC_LEN; ++ i)
eeprom_update_byte((uint8_t*)(EEPROM_FIRMWARE_PRUSA_MAGIC+i), pgm_read_byte(FW_PRUSA3D_MAGIC_STR+i)); eeprom_update_byte((uint8_t*)(EEPROM_FIRMWARE_PRUSA_MAGIC+i), pgm_read_byte(FW_PRUSA3D_MAGIC_STR+i));
uint16_t ver_current[4]; uint16_t ver_current[4];
if (parse_version_P(FW_VERSION_STR, ver_current)) { if (parse_version_P(FW_VERSION_STR, ver_current)) {
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR, ver_current[0]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR, ver_current[0]);
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR, ver_current[1]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR, ver_current[1]);
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION, ver_current[2]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION, ver_current[2]);
// See FirmwareRevisionFlavorType for the definition of firmware flavors. // See FirmwareRevisionFlavorType for the definition of firmware flavors.
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, ver_current[3]); eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, ver_current[3]);
} }
} }

View File

@ -1,35 +1,35 @@
#ifndef UTIL_H #ifndef UTIL_H
#define UTIL_H #define UTIL_H
extern const char* FW_VERSION_STR_P(); extern const char* FW_VERSION_STR_P();
// Definition of a firmware flavor numerical values. // Definition of a firmware flavor numerical values.
enum FirmwareRevisionFlavorType enum FirmwareRevisionFlavorType
{ {
FIRMWARE_REVISION_DEV = 0, FIRMWARE_REVISION_DEV = 0,
FIRMWARE_REVISION_ALPHA = 1, FIRMWARE_REVISION_ALPHA = 1,
FIRMWARE_REVISION_BETA = 2, FIRMWARE_REVISION_BETA = 2,
FIRMWARE_REVISION_RC, FIRMWARE_REVISION_RC,
FIRMWARE_REVISION_RC2, FIRMWARE_REVISION_RC2,
FIRMWARE_REVISION_RC3, FIRMWARE_REVISION_RC3,
FIRMWARE_REVISION_RC4, FIRMWARE_REVISION_RC4,
FIRMWARE_REVISION_RC5, FIRMWARE_REVISION_RC5,
FIRMWARE_REVISION_RELEASED = 127 FIRMWARE_REVISION_RELEASED = 127
}; };
extern bool show_upgrade_dialog_if_version_newer(const char *version_string); extern bool show_upgrade_dialog_if_version_newer(const char *version_string);
extern void update_current_firmware_version_to_eeprom(); extern void update_current_firmware_version_to_eeprom();
inline int8_t eeprom_read_int8(unsigned char* addr) { inline int8_t eeprom_read_int8(unsigned char* addr) {
uint8_t v = eeprom_read_byte(addr); uint8_t v = eeprom_read_byte(addr);
return *reinterpret_cast<int8_t*>(&v); return *reinterpret_cast<int8_t*>(&v);
} }
inline void eeprom_update_int8(unsigned char* addr, int8_t v) { inline void eeprom_update_int8(unsigned char* addr, int8_t v) {
eeprom_update_byte(addr, *reinterpret_cast<uint8_t*>(&v)); eeprom_update_byte(addr, *reinterpret_cast<uint8_t*>(&v));
} }
#endif /* UTIL_H */ #endif /* UTIL_H */