Merge pull request #1 from PavelSindler/MK3

fan speed check initial version, selftest updated, 3.0.12-RC2 sync
This commit is contained in:
XPila 2017-06-30 10:56:53 +02:00 committed by GitHub
commit c839209780
41 changed files with 12169 additions and 9270 deletions

View file

@ -5,11 +5,10 @@
#include "Configuration_prusa.h"
// Firmware version
#define FW_version "3.0.10-8"
#define FW_version "3.0.12-RC2"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10
// The total size of the EEPROM is
// 4096 for the Atmega2560
#define EEPROM_TOP 4096
@ -44,6 +43,10 @@
#define EEPROM_BED_CORRECTION_REAR (EEPROM_BED_CORRECTION_FRONT-1)
#define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1)
#define EEPROM_PRINT_FLAG (EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY-1)
#define EEPROM_PROBE_TEMP_SHIFT (EEPROM_PRINT_FLAG - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps
#define EEPROM_TEMP_CAL_ACTIVE (EEPROM_PROBE_TEMP_SHIFT - 1)
#define EEPROM_BOWDEN_LENGTH (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int for bowden lengths for multimaterial
#define EEPROM_CALIBRATION_STATUS_PINDA (EEPROM_BOWDEN_LENGTH - 1) //0 - not calibrated; 1 - calibrated
// Currently running firmware, each digit stored as uint16_t.
// The flavor differentiates a dev, alpha, beta, release candidate or a release version.
@ -246,7 +249,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
//#define DISABLE_MAX_ENDSTOPS
//#define DISABLE_MIN_ENDSTOPS
// Disable max endstops for compatibility with endstop checking routine
#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
#define DISABLE_MAX_ENDSTOPS
@ -265,10 +267,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define DISABLE_E false // For all extruders
#define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled
#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true
#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false
#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true
#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_E0_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
@ -422,8 +424,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XJERK 5.0 // (mm/sec)
#define DEFAULT_YJERK 5.0 // (mm/sec)
#define DEFAULT_XJERK 10.0 // (mm/sec)
#define DEFAULT_YJERK 10.0 // (mm/sec)
#define DEFAULT_ZJERK 0.2 // (mm/sec)
#define DEFAULT_EJERK 2.5 // (mm/sec)
@ -459,8 +461,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define SDSUPPORT // Enable SD Card Support in Hardware Console
//#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
#define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication
#define ENCODER_PULSES_PER_STEP 2 // Increase if you have a high resolution encoder
#define ENCODER_STEPS_PER_MENU_ITEM 2 // Set according to ENCODER_PULSES_PER_STEP or your liking
#define ENCODER_PULSES_PER_STEP 4 // Increase if you have a high resolution encoder
#define ENCODER_STEPS_PER_MENU_ITEM 1 // Set according to ENCODER_PULSES_PER_STEP or your liking
//#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
//#define ULTIPANEL //the UltiPanel as on Thingiverse
//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
@ -700,17 +702,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// (unsigned char*)EEPROM_CALIBRATION_STATUS
enum CalibrationStatus
{
// Freshly assembled, needs to peform a self-test and the XYZ calibration.
CALIBRATION_STATUS_ASSEMBLED = 255,
// Freshly assembled, needs to peform a self-test and the XYZ calibration.
CALIBRATION_STATUS_ASSEMBLED = 255,
// For the wizard: self test has been performed, now the XYZ calibration is needed.
// CALIBRATION_STATUS_XYZ_CALIBRATION = 250,
// For the wizard: self test has been performed, now the XYZ calibration is needed.
// CALIBRATION_STATUS_XYZ_CALIBRATION = 250,
// For the wizard: factory assembled, needs to run Z calibration.
CALIBRATION_STATUS_Z_CALIBRATION = 240,
// For the wizard: factory assembled, needs to run Z calibration.
CALIBRATION_STATUS_Z_CALIBRATION = 240,
// The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode.
CALIBRATION_STATUS_LIVE_ADJUST = 230,
// The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode.
CALIBRATION_STATUS_LIVE_ADJUST = 230,
// Calibrated, ready to print.
CALIBRATION_STATUS_CALIBRATED = 1,

View file

@ -22,5 +22,6 @@ FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_Prin
inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); }
inline uint8_t calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); }
inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
#endif//CONFIG_STORE_H

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

@ -31,7 +31,7 @@
#include "SdVolume.h"
//------------------------------------------------------------------------------
/**
* \struct fpos_t
* \struct filepos_t
* \brief internal type for istream
* do not use in user apps
*/

View file

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

View file

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

View file

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

View file

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

View file

@ -180,6 +180,7 @@ print $fh <<END
#ifndef LANGUAGE_ALL_H
#define LANGUAGE_ALL_H
#include <avr/pgmspace.h>
// Language indices into their particular symbol tables.
END
;
@ -242,7 +243,7 @@ $filename = 'language_all.cpp';
open($fh, '>', $filename) or die "Could not open file '$filename' $!";
print $fh <<'END'
#include <avr/pgmspace.h>
#include "Configuration_prusa.h"
#include "language_all.h"

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
#ifndef LANGUAGE_ALL_H
#define LANGUAGE_ALL_H
#include <avr/pgmspace.h>
// Language indices into their particular symbol tables.
#define LANG_ID_EN 0
#define LANG_ID_CZ 1
@ -29,6 +30,8 @@ extern const char* const MSG_ACTIVE_EXTRUDER_LANG_TABLE[1];
#define MSG_ACTIVE_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_ACTIVE_EXTRUDER_LANG_TABLE, 0)
extern const char* const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM];
#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];
#define MSG_AMAX LANG_TABLE_SELECT_EXPLICIT(MSG_AMAX_LANG_TABLE, 0)
extern const char* const MSG_AUTHOR_LANG_TABLE[1];
@ -61,8 +64,8 @@ extern const char* const MSG_BED_CORRECTION_MENU_LANG_TABLE[LANG_NUM];
#define MSG_BED_CORRECTION_MENU LANG_TABLE_SELECT(MSG_BED_CORRECTION_MENU_LANG_TABLE)
extern const char* const MSG_BED_CORRECTION_REAR_LANG_TABLE[LANG_NUM];
#define MSG_BED_CORRECTION_REAR LANG_TABLE_SELECT(MSG_BED_CORRECTION_REAR_LANG_TABLE)
extern const char* const MSG_BED_CORRECTION_RESET_LANG_TABLE[1];
#define MSG_BED_CORRECTION_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_BED_CORRECTION_RESET_LANG_TABLE, 0)
extern const char* const MSG_BED_CORRECTION_RESET_LANG_TABLE[LANG_NUM];
#define MSG_BED_CORRECTION_RESET LANG_TABLE_SELECT(MSG_BED_CORRECTION_RESET_LANG_TABLE)
extern const char* const MSG_BED_CORRECTION_RIGHT_LANG_TABLE[LANG_NUM];
#define MSG_BED_CORRECTION_RIGHT LANG_TABLE_SELECT(MSG_BED_CORRECTION_RIGHT_LANG_TABLE)
extern const char* const MSG_BED_DONE_LANG_TABLE[LANG_NUM];
@ -107,6 +110,10 @@ extern const char* const MSG_CALIBRATE_BED_RESET_LANG_TABLE[LANG_NUM];
#define MSG_CALIBRATE_BED_RESET LANG_TABLE_SELECT(MSG_CALIBRATE_BED_RESET_LANG_TABLE)
extern const char* const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM];
#define MSG_CALIBRATE_E LANG_TABLE_SELECT(MSG_CALIBRATE_E_LANG_TABLE)
extern const char* const MSG_CALIBRATE_PINDA_LANG_TABLE[LANG_NUM];
#define MSG_CALIBRATE_PINDA LANG_TABLE_SELECT(MSG_CALIBRATE_PINDA_LANG_TABLE)
extern const char* const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[LANG_NUM];
#define MSG_CALIBRATION_PINDA_MENU LANG_TABLE_SELECT(MSG_CALIBRATION_PINDA_MENU_LANG_TABLE)
extern const char* const MSG_CARD_MENU_LANG_TABLE[LANG_NUM];
#define MSG_CARD_MENU LANG_TABLE_SELECT(MSG_CARD_MENU_LANG_TABLE)
extern const char* const MSG_CHANGE_EXTR_LANG_TABLE[LANG_NUM];
@ -115,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)
extern const char* const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM];
#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];
#define MSG_CLEAN_NOZZLE_E LANG_TABLE_SELECT(MSG_CLEAN_NOZZLE_E_LANG_TABLE)
extern const char* const MSG_CNG_SDCARD_LANG_TABLE[1];
@ -135,6 +144,8 @@ extern const char* const MSG_CORRECTLY_LANG_TABLE[LANG_NUM];
#define MSG_CORRECTLY LANG_TABLE_SELECT(MSG_CORRECTLY_LANG_TABLE)
extern const char* const MSG_COUNT_X_LANG_TABLE[1];
#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];
#define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE)
extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM];
@ -169,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)
extern const char* const MSG_EXTERNAL_RESET_LANG_TABLE[1];
#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];
#define MSG_E_CAL_KNOB LANG_TABLE_SELECT(MSG_E_CAL_KNOB_LANG_TABLE)
extern const char* const MSG_Enqueing_LANG_TABLE[1];
@ -197,14 +218,14 @@ extern const char* const MSG_FILE_SAVED_LANG_TABLE[1];
#define MSG_FILE_SAVED LANG_TABLE_SELECT_EXPLICIT(MSG_FILE_SAVED_LANG_TABLE, 0)
extern const char* const MSG_FIL_ADJUSTING_LANG_TABLE[LANG_NUM];
#define MSG_FIL_ADJUSTING LANG_TABLE_SELECT(MSG_FIL_ADJUSTING_LANG_TABLE)
extern const char* const MSG_FIL_LOADED_CHECK_LANG_TABLE[LANG_NUM];
#define MSG_FIL_LOADED_CHECK LANG_TABLE_SELECT(MSG_FIL_LOADED_CHECK_LANG_TABLE)
extern const char* const MSG_FIL_TUNING_LANG_TABLE[LANG_NUM];
#define MSG_FIL_TUNING LANG_TABLE_SELECT(MSG_FIL_TUNING_LANG_TABLE)
extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE[LANG_NUM];
#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE)
extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE[LANG_NUM];
#define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE)
extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM];
#define MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE)
extern const char* const MSG_FINISHING_MOVEMENTS_LANG_TABLE[LANG_NUM];
#define MSG_FINISHING_MOVEMENTS LANG_TABLE_SELECT(MSG_FINISHING_MOVEMENTS_LANG_TABLE)
extern const char* const MSG_FLOW_LANG_TABLE[LANG_NUM];
#define MSG_FLOW LANG_TABLE_SELECT(MSG_FLOW_LANG_TABLE)
extern const char* const MSG_FLOW0_LANG_TABLE[1];
@ -251,10 +272,20 @@ extern const char* const MSG_LOADING_COLOR_LANG_TABLE[LANG_NUM];
#define MSG_LOADING_COLOR LANG_TABLE_SELECT(MSG_LOADING_COLOR_LANG_TABLE)
extern const char* const MSG_LOADING_FILAMENT_LANG_TABLE[LANG_NUM];
#define MSG_LOADING_FILAMENT LANG_TABLE_SELECT(MSG_LOADING_FILAMENT_LANG_TABLE)
extern const char* const MSG_LOAD_ALL_LANG_TABLE[LANG_NUM];
#define MSG_LOAD_ALL LANG_TABLE_SELECT(MSG_LOAD_ALL_LANG_TABLE)
extern const char* const MSG_LOAD_EPROM_LANG_TABLE[1];
#define MSG_LOAD_EPROM LANG_TABLE_SELECT_EXPLICIT(MSG_LOAD_EPROM_LANG_TABLE, 0)
extern const char* const MSG_LOAD_FILAMENT_LANG_TABLE[LANG_NUM];
#define MSG_LOAD_FILAMENT LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_LANG_TABLE)
extern const char* const MSG_LOAD_FILAMENT_1_LANG_TABLE[LANG_NUM];
#define MSG_LOAD_FILAMENT_1 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_1_LANG_TABLE)
extern const char* const MSG_LOAD_FILAMENT_2_LANG_TABLE[LANG_NUM];
#define MSG_LOAD_FILAMENT_2 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_2_LANG_TABLE)
extern const char* const MSG_LOAD_FILAMENT_3_LANG_TABLE[LANG_NUM];
#define MSG_LOAD_FILAMENT_3 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_3_LANG_TABLE)
extern const char* const MSG_LOAD_FILAMENT_4_LANG_TABLE[LANG_NUM];
#define MSG_LOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_4_LANG_TABLE)
extern const char* const MSG_LOOSE_PULLEY_LANG_TABLE[LANG_NUM];
#define MSG_LOOSE_PULLEY LANG_TABLE_SELECT(MSG_LOOSE_PULLEY_LANG_TABLE)
extern const char* const MSG_M104_INVALID_EXTRUDER_LANG_TABLE[1];
@ -343,6 +374,16 @@ extern const char* const MSG_PAUSE_PRINT_LANG_TABLE[LANG_NUM];
#define MSG_PAUSE_PRINT LANG_TABLE_SELECT(MSG_PAUSE_PRINT_LANG_TABLE)
extern const char* const MSG_PICK_Z_LANG_TABLE[LANG_NUM];
#define MSG_PICK_Z LANG_TABLE_SELECT(MSG_PICK_Z_LANG_TABLE)
extern const char* const MSG_PID_EXTRUDER_LANG_TABLE[LANG_NUM];
#define MSG_PID_EXTRUDER LANG_TABLE_SELECT(MSG_PID_EXTRUDER_LANG_TABLE)
extern const char* const MSG_PID_FINISHED_LANG_TABLE[LANG_NUM];
#define MSG_PID_FINISHED LANG_TABLE_SELECT(MSG_PID_FINISHED_LANG_TABLE)
extern const char* const MSG_PID_RUNNING_LANG_TABLE[LANG_NUM];
#define MSG_PID_RUNNING LANG_TABLE_SELECT(MSG_PID_RUNNING_LANG_TABLE)
extern const char* const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[LANG_NUM];
#define MSG_PINDA_NOT_CALIBRATED LANG_TABLE_SELECT(MSG_PINDA_NOT_CALIBRATED_LANG_TABLE)
extern const char* const MSG_PINDA_PREHEAT_LANG_TABLE[LANG_NUM];
#define MSG_PINDA_PREHEAT LANG_TABLE_SELECT(MSG_PINDA_PREHEAT_LANG_TABLE)
extern const char* const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1];
#define MSG_PLANNER_BUFFER_BYTES LANG_TABLE_SELECT_EXPLICIT(MSG_PLANNER_BUFFER_BYTES_LANG_TABLE, 0)
extern const char* const MSG_PLEASE_WAIT_LANG_TABLE[LANG_NUM];
@ -355,12 +396,16 @@ extern const char* const MSG_PREHEAT_LANG_TABLE[LANG_NUM];
#define MSG_PREHEAT LANG_TABLE_SELECT(MSG_PREHEAT_LANG_TABLE)
extern const char* const MSG_PREHEAT_NOZZLE_LANG_TABLE[LANG_NUM];
#define MSG_PREHEAT_NOZZLE LANG_TABLE_SELECT(MSG_PREHEAT_NOZZLE_LANG_TABLE)
extern const char* const MSG_PREPARE_FILAMENT_LANG_TABLE[LANG_NUM];
#define MSG_PREPARE_FILAMENT LANG_TABLE_SELECT(MSG_PREPARE_FILAMENT_LANG_TABLE)
extern const char* const MSG_PRESS_LANG_TABLE[LANG_NUM];
#define MSG_PRESS LANG_TABLE_SELECT(MSG_PRESS_LANG_TABLE)
extern const char* const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1];
#define MSG_PRINTER_DISCONNECTED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINTER_DISCONNECTED_LANG_TABLE, 0)
extern const char* const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM];
#define MSG_PRINT_ABORTED LANG_TABLE_SELECT(MSG_PRINT_ABORTED_LANG_TABLE)
extern const char* const MSG_PRINT_PAUSED_LANG_TABLE[LANG_NUM];
#define MSG_PRINT_PAUSED LANG_TABLE_SELECT(MSG_PRINT_PAUSED_LANG_TABLE)
extern const char* const MSG_PRUSA3D_LANG_TABLE[LANG_NUM];
#define MSG_PRUSA3D LANG_TABLE_SELECT(MSG_PRUSA3D_LANG_TABLE)
extern const char* const MSG_PRUSA3D_FORUM_LANG_TABLE[LANG_NUM];
@ -383,6 +428,8 @@ extern const char* const MSG_RESUME_PRINT_LANG_TABLE[LANG_NUM];
#define MSG_RESUME_PRINT LANG_TABLE_SELECT(MSG_RESUME_PRINT_LANG_TABLE)
extern const char* const MSG_RESUMING_LANG_TABLE[LANG_NUM];
#define MSG_RESUMING LANG_TABLE_SELECT(MSG_RESUMING_LANG_TABLE)
extern const char* const MSG_RESUMING_PRINT_LANG_TABLE[LANG_NUM];
#define MSG_RESUMING_PRINT LANG_TABLE_SELECT(MSG_RESUMING_PRINT_LANG_TABLE)
extern const char* const MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE[1];
#define MSG_SD_CANT_ENTER_SUBDIR LANG_TABLE_SELECT_EXPLICIT(MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE, 0)
extern const char* const MSG_SD_CANT_OPEN_SUBDIR_LANG_TABLE[1];
@ -477,6 +524,8 @@ extern const char* const MSG_SET_HOME_OFFSETS_LANG_TABLE[1];
#define MSG_SET_HOME_OFFSETS LANG_TABLE_SELECT_EXPLICIT(MSG_SET_HOME_OFFSETS_LANG_TABLE, 0)
extern const char* const MSG_SET_ORIGIN_LANG_TABLE[1];
#define MSG_SET_ORIGIN LANG_TABLE_SELECT_EXPLICIT(MSG_SET_ORIGIN_LANG_TABLE, 0)
extern const char* const MSG_SET_TEMPERATURE_LANG_TABLE[LANG_NUM];
#define MSG_SET_TEMPERATURE LANG_TABLE_SELECT(MSG_SET_TEMPERATURE_LANG_TABLE)
extern const char* const MSG_SHOW_END_STOPS_LANG_TABLE[LANG_NUM];
#define MSG_SHOW_END_STOPS LANG_TABLE_SELECT(MSG_SHOW_END_STOPS_LANG_TABLE)
extern const char* const MSG_SILENT_MODE_OFF_LANG_TABLE[LANG_NUM];
@ -517,6 +566,14 @@ extern const char* const MSG_TAKE_EFFECT_LANG_TABLE[LANG_NUM];
#define MSG_TAKE_EFFECT LANG_TABLE_SELECT(MSG_TAKE_EFFECT_LANG_TABLE)
extern const char* const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM];
#define MSG_TEMPERATURE LANG_TABLE_SELECT(MSG_TEMPERATURE_LANG_TABLE)
extern const char* const MSG_TEMP_CALIBRATION_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CALIBRATION LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_LANG_TABLE)
extern const char* const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CALIBRATION_DONE LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_DONE_LANG_TABLE)
extern const char* const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE)
extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE)
extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[LANG_NUM];
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF LANG_TABLE_SELECT(MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE)
extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON_LANG_TABLE[LANG_NUM];
@ -527,10 +584,22 @@ extern const char* const MSG_UNKNOWN_COMMAND_LANG_TABLE[1];
#define MSG_UNKNOWN_COMMAND LANG_TABLE_SELECT_EXPLICIT(MSG_UNKNOWN_COMMAND_LANG_TABLE, 0)
extern const char* const MSG_UNLOADING_FILAMENT_LANG_TABLE[LANG_NUM];
#define MSG_UNLOADING_FILAMENT LANG_TABLE_SELECT(MSG_UNLOADING_FILAMENT_LANG_TABLE)
extern const char* const MSG_UNLOAD_ALL_LANG_TABLE[LANG_NUM];
#define MSG_UNLOAD_ALL LANG_TABLE_SELECT(MSG_UNLOAD_ALL_LANG_TABLE)
extern const char* const MSG_UNLOAD_FILAMENT_LANG_TABLE[LANG_NUM];
#define MSG_UNLOAD_FILAMENT LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_LANG_TABLE)
extern const char* const MSG_UNLOAD_FILAMENT_1_LANG_TABLE[LANG_NUM];
#define MSG_UNLOAD_FILAMENT_1 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_1_LANG_TABLE)
extern const char* const MSG_UNLOAD_FILAMENT_2_LANG_TABLE[LANG_NUM];
#define MSG_UNLOAD_FILAMENT_2 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_2_LANG_TABLE)
extern const char* const MSG_UNLOAD_FILAMENT_3_LANG_TABLE[LANG_NUM];
#define MSG_UNLOAD_FILAMENT_3 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_3_LANG_TABLE)
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)
extern const char* const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM];
#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];
#define MSG_USERWAIT LANG_TABLE_SELECT(MSG_USERWAIT_LANG_TABLE)
extern const char* const MSG_VMIN_LANG_TABLE[1];

View file

@ -73,7 +73,17 @@
#define MSG_SETTINGS "Nastaveni"
#define MSG_PREHEAT "Predehrev"
#define MSG_UNLOAD_FILAMENT "Vyjmout filament"
#define MSG_LOAD_FILAMENT "Zavest filament"
#define MSG_LOAD_FILAMENT "Zavest filament"
#define MSG_LOAD_FILAMENT_1 "Zavest filament 1"
#define MSG_LOAD_FILAMENT_2 "Zavest filament 2"
#define MSG_LOAD_FILAMENT_3 "Zavest filament 3"
#define MSG_LOAD_FILAMENT_4 "Zavest filament 4"
#define MSG_UNLOAD_FILAMENT_1 "Vyjmout filam. 1"
#define MSG_UNLOAD_FILAMENT_2 "Vyjmout filam. 2"
#define MSG_UNLOAD_FILAMENT_3 "Vyjmout filam. 3"
#define MSG_UNLOAD_FILAMENT_4 "Vyjmout filam. 4"
#define MSG_UNLOAD_ALL "Vyjmout vse"
#define MSG_LOAD_ALL "Zavest vse"
#define MSG_RECTRACT "Rectract"
#define MSG_ERROR "CHYBA:"
@ -212,6 +222,7 @@
#define MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " z 9"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Merim referencni vysku kalibracniho bodu"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " z 9"
#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Iterace "
#define MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "Kalibrace XYZ selhala. Kalibracni bod podlozky nenalezen."
#define MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "Kalibrace XYZ selhala. Nahlednete do manualu."
@ -247,13 +258,12 @@
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_LOOSE_PULLEY "Uvolnena remenicka"
#define MSG_FILAMENT_LOADING_T0 "Vložte filament do extruderu 1. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T1 "Vložte filament do extruderu 2. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T2 "Vložte filament do extruderu 3. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T3 "Vložte filament do extruderu 4. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T0 "Vlozte filament do extruderu 1. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T1 "Vlozte filament do extruderu 2. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T2 "Vlozte filament do extruderu 3. Potvrdte tlacitkem."
#define MSG_FILAMENT_LOADING_T3 "Vlozte filament do extruderu 4. Potvrdte tlacitkem."
#define MSG_CHANGE_EXTR "Zmenit extruder"
#define MSG_FIL_LOADED_CHECK "Je filament zaveden?"
#define MSG_FIL_TUNING "Otacenim tlacitka doladte pozici filamentu."
#define MSG_FIL_ADJUSTING "Probiha srovnani filamentu. Prosim cekejte."
#define MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filamenty jsou srovnany. Pro uspesnou kalibraci prosim ocistete trysku. Po te potvrdte tlacitkem."
#define MSG_CALIBRATE_E "Kalibrovat E"
@ -264,4 +274,31 @@
#define MSG_FILAMENT_CLEAN "Je barva cista?"
#define MSG_UNLOADING_FILAMENT "Vysouvam filament"
#define MSG_PAPER "Umistete list papiru na podlozku a udrzujte jej pod tryskou behem mereni prvnich 4 bodu. Pokud tryska zachyti papir, vypnete tiskarnu."
#define MSG_PAPER "Umistete list papiru na podlozku a udrzujte jej pod tryskou behem mereni prvnich 4 bodu. Pokud tryska zachyti papir, vypnete tiskarnu."
#define MSG_FINISHING_MOVEMENTS "Dokoncovani pohybu"
#define MSG_PRINT_PAUSED "Tisk pozastaven"
#define MSG_RESUMING_PRINT "Obnovovani tisku"
#define MSG_PID_EXTRUDER "PID kalibrace"
#define MSG_SET_TEMPERATURE "Nastavte teplotu:"
#define MSG_PID_FINISHED "PID kal. ukoncena"
#define MSG_PID_RUNNING "PID kal. "
#define MSG_CALIBRATE_PINDA "Zkalibrovat"
#define MSG_CALIBRATION_PINDA_MENU "Teplot. kalibrace"
#define MSG_PINDA_NOT_CALIBRATED "Tiskarna nebyla teplotne zkalibrovana"
#define MSG_PINDA_PREHEAT "Nahrivani PINDA"
#define MSG_TEMP_CALIBRATION "Tepl. kal. "
#define MSG_TEMP_CALIBRATION_DONE "Teplotni kalibrace dokoncena. Pokracujte stiskem tlacitka."
#define MSG_TEMP_CALIBRATION_ON "Tepl. kal. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Tepl. kal. [OFF]"
#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

@ -69,8 +69,19 @@
#define MSG_SETTINGS "Settings"
#define MSG_PREHEAT "Preheat"
#define MSG_UNLOAD_FILAMENT "Unload filament"
#define MSG_LOAD_FILAMENT "Load filament"
#define(length=17) MSG_UNLOAD_FILAMENT "Unload filament"
#define(length=17) MSG_LOAD_FILAMENT "Load filament"
#define(length=17) MSG_LOAD_FILAMENT_1 "Load filament 1"
#define(length=17) MSG_LOAD_FILAMENT_2 "Load filament 2"
#define(length=17) MSG_LOAD_FILAMENT_3 "Load filament 3"
#define(length=17) MSG_LOAD_FILAMENT_4 "Load filament 4"
#define(length=17) MSG_UNLOAD_FILAMENT_1 "Unload filament 1"
#define(length=17) MSG_UNLOAD_FILAMENT_2 "Unload filament 2"
#define(length=17) MSG_UNLOAD_FILAMENT_3 "Unload filament 3"
#define(length=17) MSG_UNLOAD_FILAMENT_4 "Unload filament 4"
#define MSG_UNLOAD_ALL "Unload all"
#define MSG_LOAD_ALL "Load all"
#define MSG_RECTRACT "Rectract"
#define MSG_ERROR "ERROR:"
@ -162,9 +173,9 @@
#define MSG_SELFTEST_ENDSTOPS "Endstops"
#define MSG_SELFTEST_MOTOR "Motor"
#define MSG_SELFTEST_ENDSTOP "Endstop"
#define MSG_SELFTEST_ENDSTOP_NOTHIT "Endstop not hit"
#define(length=20,lines=1) MSG_SELFTEST_ENDSTOP_NOTHIT "Endstop not hit"
#define MSG_SELFTEST_OK "Self test OK"
#define MSG_LOOSE_PULLEY "Loose pulley"
#define(length=20,lines=1) MSG_LOOSE_PULLEY "Loose pulley"
#define(length=20) MSG_SELFTEST_FAN "Fan test";
#define(length=20) MSG_SELFTEST_COOLING_FAN "Front print fan?";
@ -192,7 +203,7 @@
#define MSG_HOMEYZ_PROGRESS "Calibrating Z"
#define MSG_HOMEYZ_DONE "Calibration done"
#define MSG_SHOW_END_STOPS "Show end stops"
#define(length=17,lines=1) MSG_SHOW_END_STOPS "Show end stops"
#define MSG_CALIBRATE_BED "Calibrate XYZ"
#define MSG_CALIBRATE_BED_RESET "Reset XYZ calibr."
@ -208,6 +219,7 @@
#define(length=14) MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " of 9"
#define(length=60) MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Measuring reference height of calibration point"
#define(length=14) MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " of 9"
#define(length=20) MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Iteration "
#define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "XYZ calibration failed. Bed calibration point was not found."
#define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "XYZ calibration failed. Please consult the manual."
@ -237,8 +249,6 @@
#define(length=20, lines=4) MSG_FILAMENT_LOADING_T3 "Insert filament into extruder 4. Click when done."
#define(length=20, lines=1) MSG_CHANGE_EXTR "Change extruder"
#define(length=20, lines=1) MSG_FIL_LOADED_CHECK "Is filament loaded?"
#define(length=20, lines=2) MSG_FIL_TUNING "Rotate the knob to adjust filament."
#define(length=20, lines=4) MSG_FIL_ADJUSTING "Adjusting filaments. Please wait."
#define(length=20,lines=8) MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filaments are now adjusted. Please clean the nozzle for calibration. Click when done."
#define(length=20, lines=4) MSG_STACK_ERROR "Error - static memory has been overwritten"
@ -251,18 +261,45 @@
#define(length=20, lines=8) MSG_CLEAN_NOZZLE_E "E calibration finished. Please clean the nozzle. Click when done."
#define(length=20, lines=3) MSG_WAITING_TEMP "Waiting for nozzle and bed cooling"
#define(length=20, lines=2) MSG_FILAMENT_CLEAN "Is color clear?"
#define(lenght=20) MSG_UNLOADING_FILAMENT "Unloading filament"
#define(lenght=18, lines=1) MSG_UNLOADING_FILAMENT "Unloading filament"
#define(length=20, lines=8) MSG_PAPER "Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately."
#define MSG_BED_CORRECTION_MENU "Bed level correct"
#define MSG_BED_CORRECTION_LEFT "Left side um"
#define MSG_BED_CORRECTION_RIGHT "Right side um"
#define MSG_BED_CORRECTION_FRONT "Front side um"
#define MSG_BED_CORRECTION_REAR "Rear side um"
#define(length=14,lines=1) MSG_BED_CORRECTION_LEFT "Left side [um]"
#define(length=14,lines=1) MSG_BED_CORRECTION_RIGHT "Right side[um]"
#define(length=14,lines=1) MSG_BED_CORRECTION_FRONT "Front side[um]"
#define(length=14,lines=1) MSG_BED_CORRECTION_REAR "Rear side [um]"
#define MSG_BED_CORRECTION_RESET "Reset"
#define MSG_MESH_BED_LEVELING "Mesh Bed Leveling"
#define MSG_MENU_CALIBRATION "Calibration"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_PRINTER_DISCONNECTED "Printer disconnected"
#define(length=19, lines=1) MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define(length=19, lines=1) MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#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_PRINT_PAUSED "Print paused"
#define(length=20, lines=1) MSG_RESUMING_PRINT "Resuming print"
#define(length=17, lines=1) MSG_PID_EXTRUDER "PID calibration"
#define(length=19, lines=1) MSG_SET_TEMPERATURE "Set temperature:"
#define(length=20, lines=1) MSG_PID_FINISHED "PID cal. finished"
#define(length=20, lines=1) MSG_PID_RUNNING "PID cal. "
#define(length=17, lines=1) MSG_CALIBRATE_PINDA "Calibrate"
#define(length=17, lines=1) MSG_CALIBRATION_PINDA_MENU "Temp. calibration"
#define(length=20, lines=4) MSG_PINDA_NOT_CALIBRATED "Temperature calibration has not been run yet"
#define(length=20, lines=1) MSG_PINDA_PREHEAT "PINDA Heating"
#define(length=20, lines=1) MSG_TEMP_CALIBRATION "Temp. cal. "
#define(length=20, lines=4) MSG_TEMP_CALIBRATION_DONE "Temperature calibration is finished. Click to continue."
#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_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

@ -206,6 +206,7 @@
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Medir la altura del punto de la calibracion"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " de 9"
#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Reiteracion "
#define MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "Calibracion XYZ fallada. Puntos de calibracion en la cama no encontrados."
#define MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "Calibracion XYZ fallada. Consultar el manual por favor."
#define MSG_BED_SKEW_OFFSET_DETECTION_PERFECT "Calibracion XYZ ok. Ejes X/Y perpendiculares. Felicitaciones!"
@ -242,8 +243,7 @@
#define MSG_FILAMENT_LOADING_T2 "Insertar filamento en el extrusor 3. Haga clic una vez terminado."
#define MSG_FILAMENT_LOADING_T3 "Insertar filamento en el extrusor 4. Haga clic una vez terminado."
#define MSG_CHANGE_EXTR "Cambiar extrusor."
#define MSG_FIL_LOADED_CHECK "Esta cargado el filamento?"
#define MSG_FIL_TUNING "Rotar el mando para ajustar el filamento."
#define MSG_FIL_ADJUSTING "Ajustando filamentos. Esperar por favor."
#define MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filamentos ajustados. Limpie la boquilla para calibracion. Haga clic una vez terminado."
#define MSG_CALIBRATE_E "Calibrar E"
@ -253,4 +253,46 @@
#define MSG_WAITING_TEMP "Esperando enfriamiento de la cama y del extrusor."
#define MSG_FILAMENT_CLEAN "Es el nuevo color nitido?"
#define MSG_UNLOADING_FILAMENT "Soltando filamento"
#define MSG_PAPER "Colocar una hoja de papel sobre la superficie de impresion durante la calibracion de los primeros 4 puntos. Si la boquilla mueve el papel, apagar impresora inmediatamente."
#define MSG_PAPER "Colocar una hoja de papel sobre la superficie de impresion durante la calibracion de los primeros 4 puntos. Si la boquilla mueve el papel, apagar impresora inmediatamente."
#define MSG_FINISHING_MOVEMENTS "Term. movimientos"
#define MSG_PRINT_PAUSED "Impresion en pausa"
#define MSG_RESUMING_PRINT "Reanudar impresion"
#define MSG_PID_EXTRUDER "Calibracion PID"
#define MSG_SET_TEMPERATURE "Establecer temp.:"
#define MSG_PID_FINISHED "Cal. PID terminada"
#define MSG_PID_RUNNING "Cal. PID "
#define MSG_CALIBRATE_PINDA "Calibrar"
#define MSG_CALIBRATION_PINDA_MENU "Calibracion temp."
#define MSG_PINDA_NOT_CALIBRATED "La temperatura de calibracion no ha sido ajustada"
#define MSG_PINDA_PREHEAT "Calentando PINDA"
#define MSG_TEMP_CALIBRATION "Cal. temp. "
#define MSG_TEMP_CALIBRATION_DONE "Calibracon temperatura terminada. Presionar para continuar."
#define MSG_TEMP_CALIBRATION_ON "Cal. temp. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Cal. temp. [OFF]"
#define MSG_PREPARE_FILAMENT "Preparar filamento"
#define MSG_LOAD_ALL "Intr. todos fil."
#define MSG_LOAD_FILAMENT_1 "Introducir fil. 1"
#define MSG_LOAD_FILAMENT_2 "Introducir fil. 2"
#define MSG_LOAD_FILAMENT_3 "Introducir fil. 3"
#define MSG_LOAD_FILAMENT_4 "Introducir fil. 4"
#define MSG_UNLOAD_FILAMENT_1 "Soltar fil. 1"
#define MSG_UNLOAD_FILAMENT_2 "Soltar fil. 2"
#define MSG_UNLOAD_FILAMENT_3 "Soltar fil. 3"
#define MSG_UNLOAD_FILAMENT_4 "Soltar fil. 4"
#define MSG_UNLOAD_ALL "Soltar todos fil."
#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,251 +1,289 @@
#define WELCOME_MSG CUSTOM_MENDEL_NAME " pronta."
#define MSG_SD_INSERTED "SD inserita"
#define MSG_SD_REMOVED "SD rimossa"
#define MSG_MAIN "Menu principale"
#define MSG_DISABLE_STEPPERS "Disabilit motori"
#define MSG_AUTO_HOME "Trova origine"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Set origin"
#define MSG_COOLDOWN "Raffredda"
#define MSG_SWITCH_PS_ON "Switch power on"
#define MSG_SWITCH_PS_OFF "Switch power off"
#define MSG_MOVE_AXIS "Muovi asse"
#define MSG_MOVE_X "Muovi X"
#define MSG_MOVE_Y "Muovi Y"
#define MSG_MOVE_Z "Muovi Z"
#define MSG_MOVE_E "Muovi Estrusore"
#define MSG_MOVE_01MM "Move 0.1mm"
#define MSG_MOVE_1MM "Move 1mm"
#define MSG_MOVE_10MM "Move 10mm"
#define MSG_SPEED "Velocita"
#define MSG_NOZZLE "Ugello"
#define MSG_NOZZLE1 "Nozzle2"
#define MSG_NOZZLE2 "Nozzle3"
#define MSG_BED "Letto"
#define MSG_FAN_SPEED "Velocita vent."
#define MSG_FLOW "Flusso"
#define MSG_TEMPERATURE "Temperatura"
#define MSG_MOTION "Motion"
#define MSG_VOLUMETRIC "Filament"
#define MSG_VOLUMETRIC_ENABLED "E in mm3"
#define MSG_STORE_EPROM "Store memory"
#define MSG_LOAD_EPROM "Load memory"
#define MSG_RESTORE_FAILSAFE "Restore failsafe"
#define MSG_REFRESH "\xF8" "Refresh"
#define MSG_WATCH "Schermata info"
#define MSG_TUNE "Regola"
#define MSG_PAUSE_PRINT "Metti in pausa"
#define MSG_RESUME_PRINT "Riprendi stampa"
#define MSG_STOP_PRINT "Arresta stampa"
#define MSG_CARD_MENU "Stampa da SD"
#define MSG_NO_CARD "Nessuna SD"
#define MSG_DWELL "Sospensione..."
#define MSG_USERWAIT "Attendendo utente"
#define MSG_RESUMING "Riprendi stampa"
#define MSG_PRINT_ABORTED "Stampa abortita"
#define MSG_NO_MOVE "Nessun movimento."
#define MSG_KILLED "IN TILT."
#define MSG_STOPPED "ARRESTATO."
#define MSG_FILAMENTCHANGE "Camb. filamento"
#define MSG_INIT_SDCARD "Init. SD card"
#define MSG_CNG_SDCARD "Change SD card"
#define MSG_ZPROBE_OUT "Z probe out. bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
#define MSG_BABYSTEP_X "Babystep X"
#define MSG_BABYSTEP_Y "Babystep Y"
#define MSG_BABYSTEP_Z "Compensazione Z"
#define MSG_ADJUSTZ "Autoregolare Z?"
#define MSG_PICK_Z "Pick print"
#define MSG_SETTINGS "Impostazioni"
#define MSG_PREHEAT "Preriscalda"
#define MSG_HEATING "Riscaldamento..."
#define MSG_SUPPORT "Support"
#define MSG_YES "Si"
#define MSG_NO "No"
#define MSG_NOT_LOADED "Fil. non caricato"
#define MSG_NOT_COLOR "Colore non puro"
#define MSG_LOADING_COLOR "Caricando colore"
#define MSG_CHANGE_SUCCESS "Cambio riuscito!"
#define MSG_PRESS "e cliccare manopola"
#define MSG_INSERT_FILAMENT "Inserire filamento"
#define MSG_CHANGING_FILAMENT "Cambiando filam."
#define MSG_PLEASE_WAIT "Aspetta"
#define MSG_PREHEAT_NOZZLE "Preris. ugello!"
#define MSG_HEATING_COMPLETE "Riscald. completo"
#define MSG_BED_HEATING "Riscald. letto"
#define MSG_BED_DONE "Piatto fatto."
#define MSG_ERROR "ERRORE:"
#define MSG_CORRECTLY "Cambiato corr.?"
#define MSG_LOADING_FILAMENT "Caricando filam."
#define MSG_UNLOAD_FILAMENT "Scarica filamento"
#define MSG_LOAD_FILAMENT "Carica filamento"
#define MSG_SILENT_MODE_ON "Modo [silenzioso]"
#define MSG_SILENT_MODE_OFF "Mode [forte]"
#define MSG_REBOOT "Riavvia stampante"
#define MSG_TAKE_EFFECT " per attualizzare"
#define MSG_Enqueing "enqueing \""
#define MSG_POWERUP "PowerUp"
#define MSG_CONFIGURATION_VER " Last Updated: "
#define MSG_FREE_MEMORY " Free Memory: "
#define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
#define MSG_OK "ok"
#define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "
#define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: "
#define MSG_BEGIN_FILE_LIST "Begin file list"
#define MSG_END_FILE_LIST "End file list"
#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
#define MSG_M221_INVALID_EXTRUDER "M221 Invalid extruder "
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#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_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_RESEND "Resend: "
#define MSG_M119_REPORT "Reporting endstop status"
#define MSG_ENDSTOP_HIT "TRIGGERED"
#define MSG_ENDSTOP_OPEN "open"
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
#define MSG_SD_INIT_FAIL "SD init fail"
#define MSG_SD_VOL_INIT_FAIL "volume.init failed"
#define MSG_SD_OPENROOT_FAIL "openRoot failed"
#define MSG_SD_CARD_OK "SD card ok"
#define MSG_SD_WORKDIR_FAIL "workDir open failed"
#define MSG_SD_OPEN_FILE_FAIL "open failed, File: "
#define MSG_SD_FILE_OPENED "File opened: "
#define MSG_SD_FILE_SELECTED "File selected"
#define MSG_SD_WRITE_TO_FILE "Writing to file: "
#define MSG_SD_PRINTING_BYTE "SD printing byte "
#define MSG_SD_NOT_PRINTING "Not SD printing"
#define MSG_SD_ERR_WRITE_TO_FILE "error writing to file"
#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: "
#define MSG_STEPPER_TOO_HIGH "Steprate too high: "
#define MSG_ENDSTOPS_HIT "endstops hit: "
#define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented"
#define MSG_BABYSTEPPING_X "Babystepping X"
#define MSG_BABYSTEPPING_Y "Babystepping Y"
#define MSG_BABYSTEPPING_Z "Adjusting Z"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Error in menu structure"
#define MSG_LANGUAGE_NAME "Italiano"
#define MSG_LANGUAGE_SELECT "Seleziona lingua"
#define MSG_PRUSA3D "prusa3d.com"
#define MSG_PRUSA3D_FORUM "forum.prusa3d.com"
#define MSG_PRUSA3D_HOWTO "howto.prusa3d.com"
#define MSG_SELFTEST_ERROR "Autotest negativo"
#define MSG_SELFTEST_PLEASECHECK "Verificare:"
#define MSG_SELFTEST_NOTCONNECTED "Non connesso"
#define MSG_SELFTEST_HEATERTHERMISTOR "Riscald./Termist."
#define MSG_SELFTEST_BEDHEATER "Letto/Riscald."
#define MSG_SELFTEST_WIRINGERROR "Errore cablaggio"
#define MSG_SELFTEST_ENDSTOPS "Finecorsa (2)"
#define MSG_SELFTEST_MOTOR "Motore"
#define MSG_SELFTEST_ENDSTOP "Finecorsa"
#define MSG_SELFTEST_ENDSTOP_NOTHIT "Finec. fuori por."
#define MSG_SELFTEST_OK "Autotest OK"
#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_EXTRUDER_FAN "Vent SX sull'ugello?";
#define MSG_SELFTEST_FAN_YES "Gira";
#define MSG_SELFTEST_FAN_NO "Non si gira";
#define MSG_STATS_TOTALFILAMENT "Filamento tot:"
#define MSG_STATS_TOTALPRINTTIME "Tempo stampa tot:"
#define MSG_STATS_FILAMENTUSED "Filamento usato:"
#define MSG_STATS_PRINTTIME "Tempo di stampa:"
#define MSG_SELFTEST_START "Avvia autotest"
#define MSG_SELFTEST_CHECK_ENDSTOPS "Verifica finecorsa"
#define MSG_SELFTEST_CHECK_HOTEND "Verifica ugello"
#define MSG_SELFTEST_CHECK_X "Verifica asse X"
#define MSG_SELFTEST_CHECK_Y "Verifica asse Y"
#define MSG_SELFTEST_CHECK_Z "Verifica asse Z"
#define MSG_SELFTEST_CHECK_BED "Verifica letto"
#define MSG_SELFTEST_CHECK_ALLCORRECT "Nessun errore"
#define MSG_SELFTEST "Autotest"
#define MSG_SELFTEST_FAILED "Autotest fallito"
#define MSG_STATISTICS "Statistiche"
#define MSG_USB_PRINTING "Stampa da USB"
#define MSG_HOMEYZ "Calibra Z"
#define MSG_HOMEYZ_PROGRESS "Calibrando Z"
#define MSG_HOMEYZ_DONE "Calibrazione OK"
#define MSG_SHOW_END_STOPS "Stato finecorsa"
#define MSG_CALIBRATE_BED "Calibra XYZ"
#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_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_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_LINE2 " su 4"
#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_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_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_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_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_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_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_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_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_NEW_FIRMWARE_AVAILABLE "Nuova versione del firmware disponibile"
#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_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_LEFT "Lato sinistro"
#define MSG_BED_CORRECTION_RIGHT "Lato destro"
#define MSG_BED_CORRECTION_FRONT "Lato ateriore"
#define MSG_BED_CORRECTION_REAR "Lato posteriore"
#define MSG_BED_CORRECTION_RESET "Reset"
#define MSG_MESH_BED_LEVELING "Mesh livel. letto"
#define MSG_MENU_CALIBRATION "Calibrazione"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_LOOSE_PULLEY "Puleggia lenta"
#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_T2 "Inserire filamento nell'estrusore 3. Click per continuare."
#define MSG_FILAMENT_LOADING_T3 "Inserire filamento nell'estrusore 4. Click per continuare."
#define MSG_CHANGE_EXTR "Cambio estrusore."
#define MSG_FIL_LOADED_CHECK "Filamento caricato?"
#define MSG_FIL_TUNING "Girare la manopola per regolare il filamento"
#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_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_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_WAITING_TEMP "In attesa del raffreddamento della testina e del piatto"
#define MSG_FILAMENT_CLEAN "Il colore e' nitido?"
#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 WELCOME_MSG CUSTOM_MENDEL_NAME " pronta."
#define MSG_SD_INSERTED "SD inserita"
#define MSG_SD_REMOVED "SD rimossa"
#define MSG_MAIN "Menu principale"
#define MSG_DISABLE_STEPPERS "Disabilit motori"
#define MSG_AUTO_HOME "Trova origine"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Set origin"
#define MSG_COOLDOWN "Raffredda"
#define MSG_SWITCH_PS_ON "Switch power on"
#define MSG_SWITCH_PS_OFF "Switch power off"
#define MSG_MOVE_AXIS "Muovi asse"
#define MSG_MOVE_X "Muovi X"
#define MSG_MOVE_Y "Muovi Y"
#define MSG_MOVE_Z "Muovi Z"
#define MSG_MOVE_E "Muovi Estrusore"
#define MSG_MOVE_01MM "Move 0.1mm"
#define MSG_MOVE_1MM "Move 1mm"
#define MSG_MOVE_10MM "Move 10mm"
#define MSG_SPEED "Velocita"
#define MSG_NOZZLE "Ugello"
#define MSG_NOZZLE1 "Nozzle2"
#define MSG_NOZZLE2 "Nozzle3"
#define MSG_BED "Letto"
#define MSG_FAN_SPEED "Velocita vent."
#define MSG_FLOW "Flusso"
#define MSG_TEMPERATURE "Temperatura"
#define MSG_MOTION "Motion"
#define MSG_VOLUMETRIC "Filament"
#define MSG_VOLUMETRIC_ENABLED "E in mm3"
#define MSG_STORE_EPROM "Store memory"
#define MSG_LOAD_EPROM "Load memory"
#define MSG_RESTORE_FAILSAFE "Restore failsafe"
#define MSG_REFRESH "\xF8" "Refresh"
#define MSG_WATCH "Schermata info"
#define MSG_TUNE "Regola"
#define MSG_PAUSE_PRINT "Metti in pausa"
#define MSG_RESUME_PRINT "Riprendi stampa"
#define MSG_STOP_PRINT "Arresta stampa"
#define MSG_CARD_MENU "Stampa da SD"
#define MSG_NO_CARD "Nessuna SD"
#define MSG_DWELL "Sospensione..."
#define MSG_USERWAIT "Attendendo utente"
#define MSG_RESUMING "Riprendi stampa"
#define MSG_PRINT_ABORTED "Stampa abortita"
#define MSG_NO_MOVE "Nessun movimento."
#define MSG_KILLED "IN TILT."
#define MSG_STOPPED "ARRESTATO."
#define MSG_FILAMENTCHANGE "Camb. filamento"
#define MSG_INIT_SDCARD "Init. SD card"
#define MSG_CNG_SDCARD "Change SD card"
#define MSG_ZPROBE_OUT "Z probe out. bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
#define MSG_BABYSTEP_X "Babystep X"
#define MSG_BABYSTEP_Y "Babystep Y"
#define MSG_BABYSTEP_Z "Compensazione Z"
#define MSG_ADJUSTZ "Autoregolare Z?"
#define MSG_PICK_Z "Pick print"
#define MSG_SETTINGS "Impostazioni"
#define MSG_PREHEAT "Preriscalda"
#define MSG_HEATING "Riscaldamento..."
#define MSG_SUPPORT "Support"
#define MSG_YES "Si"
#define MSG_NO "No"
#define MSG_NOT_LOADED "Fil. non caricato"
#define MSG_NOT_COLOR "Colore non puro"
#define MSG_LOADING_COLOR "Caricando colore"
#define MSG_CHANGE_SUCCESS "Cambio riuscito!"
#define MSG_PRESS "e cliccare manopola"
#define MSG_INSERT_FILAMENT "Inserire filamento"
#define MSG_CHANGING_FILAMENT "Cambiando filam."
#define MSG_PLEASE_WAIT "Aspetta"
#define MSG_PREHEAT_NOZZLE "Preris. ugello!"
#define MSG_HEATING_COMPLETE "Riscald. completo"
#define MSG_BED_HEATING "Riscald. letto"
#define MSG_BED_DONE "Piatto fatto."
#define MSG_ERROR "ERRORE:"
#define MSG_CORRECTLY "Cambiato corr.?"
#define MSG_LOADING_FILAMENT "Caricando filam."
#define MSG_UNLOAD_FILAMENT "Scarica filamento"
#define MSG_LOAD_FILAMENT "Carica filamento"
#define MSG_SILENT_MODE_ON "Modo [silenzioso]"
#define MSG_SILENT_MODE_OFF "Mode [forte]"
#define MSG_REBOOT "Riavvia stampante"
#define MSG_TAKE_EFFECT " per attualizzare"
#define MSG_Enqueing "enqueing \""
#define MSG_POWERUP "PowerUp"
#define MSG_CONFIGURATION_VER " Last Updated: "
#define MSG_FREE_MEMORY " Free Memory: "
#define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
#define MSG_OK "ok"
#define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "
#define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: "
#define MSG_BEGIN_FILE_LIST "Begin file list"
#define MSG_END_FILE_LIST "End file list"
#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
#define MSG_M221_INVALID_EXTRUDER "M221 Invalid extruder "
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#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_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_RESEND "Resend: "
#define MSG_M119_REPORT "Reporting endstop status"
#define MSG_ENDSTOP_HIT "TRIGGERED"
#define MSG_ENDSTOP_OPEN "open"
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
#define MSG_SD_INIT_FAIL "SD init fail"
#define MSG_SD_VOL_INIT_FAIL "volume.init failed"
#define MSG_SD_OPENROOT_FAIL "openRoot failed"
#define MSG_SD_CARD_OK "SD card ok"
#define MSG_SD_WORKDIR_FAIL "workDir open failed"
#define MSG_SD_OPEN_FILE_FAIL "open failed, File: "
#define MSG_SD_FILE_OPENED "File opened: "
#define MSG_SD_FILE_SELECTED "File selected"
#define MSG_SD_WRITE_TO_FILE "Writing to file: "
#define MSG_SD_PRINTING_BYTE "SD printing byte "
#define MSG_SD_NOT_PRINTING "Not SD printing"
#define MSG_SD_ERR_WRITE_TO_FILE "error writing to file"
#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: "
#define MSG_STEPPER_TOO_HIGH "Steprate too high: "
#define MSG_ENDSTOPS_HIT "endstops hit: "
#define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented"
#define MSG_BABYSTEPPING_X "Babystepping X"
#define MSG_BABYSTEPPING_Y "Babystepping Y"
#define MSG_BABYSTEPPING_Z "Adjusting Z"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Error in menu structure"
#define MSG_LANGUAGE_NAME "Italiano"
#define MSG_LANGUAGE_SELECT "Seleziona lingua"
#define MSG_PRUSA3D "prusa3d.com"
#define MSG_PRUSA3D_FORUM "forum.prusa3d.com"
#define MSG_PRUSA3D_HOWTO "howto.prusa3d.com"
#define MSG_SELFTEST_ERROR "Autotest negativo"
#define MSG_SELFTEST_PLEASECHECK "Verificare:"
#define MSG_SELFTEST_NOTCONNECTED "Non connesso"
#define MSG_SELFTEST_HEATERTHERMISTOR "Riscald./Termist."
#define MSG_SELFTEST_BEDHEATER "Letto/Riscald."
#define MSG_SELFTEST_WIRINGERROR "Errore cablaggio"
#define MSG_SELFTEST_ENDSTOPS "Finecorsa (2)"
#define MSG_SELFTEST_MOTOR "Motore"
#define MSG_SELFTEST_ENDSTOP "Finecorsa"
#define MSG_SELFTEST_ENDSTOP_NOTHIT "Finec. fuori por."
#define MSG_SELFTEST_OK "Autotest OK"
#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_EXTRUDER_FAN "Vent SX sull'ugello?";
#define MSG_SELFTEST_FAN_YES "Gira";
#define MSG_SELFTEST_FAN_NO "Non si gira";
#define MSG_STATS_TOTALFILAMENT "Filamento tot:"
#define MSG_STATS_TOTALPRINTTIME "Tempo stampa tot:"
#define MSG_STATS_FILAMENTUSED "Filamento usato:"
#define MSG_STATS_PRINTTIME "Tempo di stampa:"
#define MSG_SELFTEST_START "Avvia autotest"
#define MSG_SELFTEST_CHECK_ENDSTOPS "Verifica finecorsa"
#define MSG_SELFTEST_CHECK_HOTEND "Verifica ugello"
#define MSG_SELFTEST_CHECK_X "Verifica asse X"
#define MSG_SELFTEST_CHECK_Y "Verifica asse Y"
#define MSG_SELFTEST_CHECK_Z "Verifica asse Z"
#define MSG_SELFTEST_CHECK_BED "Verifica letto"
#define MSG_SELFTEST_CHECK_ALLCORRECT "Nessun errore"
#define MSG_SELFTEST "Autotest"
#define MSG_SELFTEST_FAILED "Autotest fallito"
#define MSG_STATISTICS "Statistiche"
#define MSG_USB_PRINTING "Stampa da USB"
#define MSG_HOMEYZ "Calibra Z"
#define MSG_HOMEYZ_PROGRESS "Calibrando Z"
#define MSG_HOMEYZ_DONE "Calibrazione OK"
#define MSG_SHOW_END_STOPS "Stato finecorsa"
#define MSG_CALIBRATE_BED "Calibra XYZ"
#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_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_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_LINE2 " su 4"
#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_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_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_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_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_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_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_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_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_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_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_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_LEFT "Sinistra [um]"
#define MSG_BED_CORRECTION_RIGHT "Destra [um]"
#define MSG_BED_CORRECTION_FRONT "Fronte [um]"
#define MSG_BED_CORRECTION_REAR "Retro [um]"
#define MSG_BED_CORRECTION_RESET "Reset"
#define MSG_MESH_BED_LEVELING "Mesh livel. letto"
#define MSG_MENU_CALIBRATION "Calibrazione"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_LOOSE_PULLEY "Puleggia lenta"
#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_T2 "Inserire filamento nell'estrusore 3. Click per continuare."
#define MSG_FILAMENT_LOADING_T3 "Inserire filamento nell'estrusore 4. Click per continuare."
#define MSG_CHANGE_EXTR "Cambio estrusore."
#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_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_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_WAITING_TEMP "In attesa del raffreddamento della testina e del piatto"
#define MSG_FILAMENT_CLEAN "Il colore e' nitido?"
#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_FINISHING_MOVEMENTS "Arresto in corso"
#define MSG_PRINT_PAUSED "Stampa in pausa"
#define MSG_RESUMING_PRINT "Stampa in ripresa"
#define MSG_PID_EXTRUDER "Calibrazione PID"
#define MSG_SET_TEMPERATURE "Imposta temperatura"
#define MSG_PID_FINISHED "Cal. PID completa"
#define MSG_PID_RUNNING "Cal. PID"
#define MSG_CALIBRATE_PINDA "Calibrare"
#define MSG_CALIBRATION_PINDA_MENU "Taratura temp."
#define MSG_PINDA_NOT_CALIBRATED "Taratura della temperatura non ancora eseguita"
#define MSG_PINDA_PREHEAT "Riscald. PINDA"
#define MSG_TEMP_CALIBRATION "Cal. temp. "
#define MSG_TEMP_CALIBRATION_DONE "Taratura temperatura terminata. Fare click per continuare."
#define MSG_TEMP_CALIBRATION_ON "Cal. temp. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Cal. temp. [OFF]"
#define MSG_LOAD_ALL "Caricare tutti"
#define MSG_LOAD_FILAMENT_1 "Caricare fil. 1"
#define MSG_LOAD_FILAMENT_2 "Caricare fil. 2"
#define MSG_LOAD_FILAMENT_3 "Caricare fil. 3"
#define MSG_LOAD_FILAMENT_4 "Caricare fil. 4"
#define MSG_UNLOAD_FILAMENT_1 "Rilasciare fil. 1"
#define MSG_UNLOAD_FILAMENT_2 "Rilasciare fil. 1"
#define MSG_UNLOAD_FILAMENT_3 "Rilasciare fil. 1"
#define MSG_UNLOAD_FILAMENT_4 "Rilasciare fil. 1"
#define MSG_UNLOAD_ALL "Rilasciare tutti"
#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

@ -211,6 +211,7 @@
#define MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " z 9"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Okreslam wysokosc odniesienia punktu kalibracyjnego"
#define MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " z 9"
#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Iteracja "
#define MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "Kalibr. XYZ nieudana. Kalibracyjny punkt podkladki nieznaleziony."
#define MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "Kalibracja XYZ niepowiedziona. Sprawdzic w instrukcji."
@ -248,8 +249,7 @@
#define MSG_FILAMENT_LOADING_T2 "Wloz filament do ekstrudera 3. Potwierdz przyciskiem."
#define MSG_FILAMENT_LOADING_T3 "Wloz filament do ekstrudera 4. Potwierdz przyciskiem."
#define MSG_CHANGE_EXTR "Zmienic ekstruder"
#define MSG_FIL_LOADED_CHECK "Czy filament jest wprowadzony?"
#define MSG_FIL_TUNING "Obrotem przycisku dostroj pozycje filamentu."
#define MSG_FIL_ADJUSTING "Przebiega wyrownanie filamentow. Prosze czekac."
#define MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Dla prawidlowej kalibracji prosze oczyscic dysze. Potem potwierdzic przyciskiem."
#define MSG_CALIBRATE_E "Kalibruj E"
@ -259,4 +259,43 @@
#define MSG_WAITING_TEMP "Oczekiwanie na wychlodzenie dyszy i podkladki."
#define MSG_FILAMENT_CLEAN "Czy kolor jest czysty?"
#define MSG_UNLOADING_FILAMENT "Wysuwam filament"
#define MSG_PAPER "Umiesc kartke papieru na podkladce i trzymaj pod dysza podczas pomiaru pierwszych 4 punktow. Jesli dysza zahaczy o papier, wylacz drukarke."
#define MSG_PAPER "Umiesc kartke papieru na podkladce i trzymaj pod dysza podczas pomiaru pierwszych 4 punktow. Jesli dysza zahaczy o papier, wylacz drukarke."
#define MSG_FINISHING_MOVEMENTS "Konczenie druku"
#define MSG_PRINT_PAUSED "Druk zatrzymany"
#define MSG_RESUMING_PRINT "Wznawianie druku"
#define MSG_PID_EXTRUDER "Kalibracja PID"
#define MSG_SET_TEMPERATURE "Ustawic temperature"
#define MSG_PID_FINISHED "Kal. PID zakonczona"
#define MSG_PID_RUNNING "Kal. PID"
#define MSG_CALIBRATE_PINDA "Skalibrowac"
#define MSG_CALIBRATION_PINDA_MENU "Cieplna kalibr."
#define MSG_PINDA_NOT_CALIBRATED "Cieplna kalibracja nie byla przeprowadzona"
#define MSG_PINDA_PREHEAT "Grzanie PINDA"
#define MSG_TEMP_CALIBRATION "Ciepl. kal. "
#define MSG_TEMP_CALIBRATION_DONE "Cieplna kalibracja zakonczona. Kontynuuj przyciskiem"
#define MSG_TEMP_CALIBRATION_ON "Ciepl. kal. [ON]"
#define MSG_TEMP_CALIBRATION_OFF "Ciepl. kal. [OFF]"
#define MSG_PREPARE_FILAMENT "Przygotuj filament"
#define MSG_LOAD_ALL "Zalad. wszystkie"
#define MSG_LOAD_FILAMENT_1 "Zaladowac fil. 1"
#define MSG_LOAD_FILAMENT_2 "Zaladowac fil. 2"
#define MSG_LOAD_FILAMENT_3 "Zaladowac fil. 3"
#define MSG_LOAD_FILAMENT_4 "Zaladowac fil. 4"
#define MSG_UNLOAD_FILAMENT_1 "Wyjac filament 1"
#define MSG_UNLOAD_FILAMENT_2 "Wyjac filament 2"
#define MSG_UNLOAD_FILAMENT_3 "Wyjac filament 3"
#define MSG_UNLOAD_FILAMENT_4 "Wyjac filament 4"
#define MSG_UNLOAD_ALL "Wyjac wszystkie"
#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"

29
Firmware/le.sh Normal file
View file

@ -0,0 +1,29 @@
# line ending management script
# CRLF - windows default ('\r\n')
# LF - unix default ('\n')
# arguments:
# ?crlf - print all .cpp and .h files with CRLF line endings
# ?lf - print all .cpp and .h files with LF line endings
# crlf - replace line endings in all .cpp and .h files to CRLF
# lf - replace line endings in all .cpp and .h files to LF
if [ "$1" == "?crlf" ] || [ $# -eq 0 ]; then
echo 'cpp and h files with CRLF line endings:'
find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep CRLF | sed 's/:.*//g'
elif [ "$1" == "?lf" ]; then
echo 'cpp and h files with LF line endings:'
find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep -v CRLF | sed 's/:.*//g'
fi
if [ "$1" == "crlf" ]; then
echo 'replacing LF with CRLF in all cpp and h files:'
find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep -v CRLF | sed 's/:.*//g' | while read fn; do
echo "$fn"
sed -i 's/$/\r/g' $fn
done
elif [ "$1" == "lf" ]; then
echo 'replacing CRLF with LF in all cpp and h files:'
find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep CRLF | sed 's/:.*//g' | while read fn; do
echo "$fn"
sed -i 's/\r\n/\n/g' $fn
done
fi

File diff suppressed because it is too large Load diff

View file

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

View file

@ -315,12 +315,9 @@
#endif
/*****************************************************************
* EINY Rambo Pin Assignments 0.1a
******************************************************************/
* EINY Rambo Pin Assignments 0.1a
******************************************************************/
#if MOTHERBOARD == 300
#define ELECTRONICS "EINY_01a"
#define KNOWN_BOARD
@ -415,6 +412,9 @@
#define SDCARDDETECT 15
#define TACH_0 81
#define TACH_1 80
#endif //NEWPANEL
#endif //ULTRA_LCD
@ -424,7 +424,6 @@
#ifndef KNOWN_BOARD
#error Unknown MOTHERBOARD value in configuration.h
#endif

View file

@ -171,7 +171,9 @@ FORCE_INLINE block_t *plan_get_current_block()
}
// Returns true if the buffer has a queued block, false otherwise
FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
FORCE_INLINE bool blocks_queued() {
return (block_buffer_head != block_buffer_tail);
}
//return the nr of buffered moves
FORCE_INLINE uint8_t moves_planned() {

View file

@ -33,8 +33,9 @@
#include <SPI.h>
#endif
#ifdef HAVE_TMC2130_DRIVERS
#include <SPI.h>
#endif
#include "tmc2130.h"
#endif //HAVE_TMC2130_DRIVERS
//===========================================================================
//=============================public variables ============================
@ -83,17 +84,12 @@ static bool old_z_min_endstop=false;
static bool old_z_max_endstop=false;
#ifdef SG_HOMING
static bool check_endstops = false;
static bool check_endstops = false;
#else
static bool check_endstops = true;
static bool check_endstops = true;
#endif
static bool check_z_endstop = false;
static uint8_t sg_homing_axis = 0xFF;
static uint8_t sg_axis_stalled[2] = {0, 0};
static uint8_t sg_lastHomingStalled = false;
int8_t SilentMode;
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
@ -408,11 +404,6 @@ ISR(TIMER1_COMPA_vect)
{
#if defined(X_MIN_PIN) && X_MIN_PIN > -1
bool x_min_endstop=(READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING);
#ifdef SG_HOMING
x_min_endstop=false;
#endif
if(sg_homing_axis == X_AXIS && !x_min_endstop)
x_min_endstop = sg_axis_stalled[X_AXIS];
if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
endstop_x_hit=true;
@ -429,8 +420,6 @@ ISR(TIMER1_COMPA_vect)
{
#if defined(X_MAX_PIN) && X_MAX_PIN > -1
bool x_max_endstop=(READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING);
if(sg_homing_axis == X_AXIS && !x_max_endstop)
x_max_endstop = sg_axis_stalled[X_AXIS];
if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
endstop_x_hit=true;
@ -451,11 +440,6 @@ ISR(TIMER1_COMPA_vect)
{
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
bool y_min_endstop=(READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING);
#ifdef SG_HOMING
y_min_endstop=false;
#endif
if(sg_homing_axis == Y_AXIS && !y_min_endstop)
y_min_endstop = sg_axis_stalled[Y_AXIS];
if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
endstop_y_hit=true;
@ -470,8 +454,6 @@ ISR(TIMER1_COMPA_vect)
{
#if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
bool y_max_endstop=(READ(Y_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING);
if(sg_homing_axis == Y_AXIS && !y_max_endstop)
y_max_endstop = sg_axis_stalled[Y_AXIS];
if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
endstop_y_hit=true;
@ -540,14 +522,39 @@ ISR(TIMER1_COMPA_vect)
}
#endif
if ((out_bits & (1<<E_AXIS)) != 0) { // -direction
REV_E_DIR();
count_direction[E_AXIS]=-1;
}
else { // +direction
NORM_E_DIR();
count_direction[E_AXIS]=1;
}
if ((out_bits & (1 << E_AXIS)) != 0)
{ // -direction
//AKU
#ifdef SNMM
if (snmm_extruder == 0 || snmm_extruder == 2)
{
NORM_E_DIR();
}
else
{
REV_E_DIR();
}
#else
REV_E_DIR();
#endif // SNMM
count_direction[E_AXIS] = -1;
}
else
{ // +direction
#ifdef SNMM
if (snmm_extruder == 0 || snmm_extruder == 2)
{
REV_E_DIR();
}
else
{
NORM_E_DIR();
}
#else
NORM_E_DIR();
#endif // SNMM
count_direction[E_AXIS] = 1;
}
for(uint8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves)
#ifndef AT90USB
@ -654,321 +661,15 @@ ISR(TIMER1_COMPA_vect)
plan_discard_current_block();
}
}
check_fans();
}
#ifdef HAVE_TMC2130_DRIVERS
uint32_t tmc2130_read(uint8_t chipselect, uint8_t address)
{
uint32_t val32;
uint8_t val0;
uint8_t val1;
uint8_t val2;
uint8_t val3;
uint8_t val4;
//datagram1 - read request (address + dummy write)
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address);
SPI.transfer(0);
SPI.transfer(0);
SPI.transfer(0);
SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
//datagram2 - response
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
val0 = SPI.transfer(0);
val1 = SPI.transfer(0);
val2 = SPI.transfer(0);
val3 = SPI.transfer(0);
val4 = SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
#ifdef TMC_DBG_READS
MYSERIAL.print("SPIRead 0x");
MYSERIAL.print(address,HEX);
MYSERIAL.print(" Status:");
MYSERIAL.print(val0 & 0b00000111,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val1,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val2,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val3,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val4,BIN);
#endif
val32 = (uint32_t)val1<<24 | (uint32_t)val2<<16 | (uint32_t)val3<<8 | (uint32_t)val4;
#ifdef TMC_DBG_READS
MYSERIAL.print(" 0x");
MYSERIAL.println(val32,HEX);
#endif
return val32;
}
void tmc2130_write(uint8_t chipselect, uint8_t address,uint8_t wval1,uint8_t wval2,uint8_t wval3,uint8_t wval4)
{
uint32_t val32;
uint8_t val0;
uint8_t val1;
uint8_t val2;
uint8_t val3;
uint8_t val4;
//datagram1 - write
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address+0x80);
SPI.transfer(wval1);
SPI.transfer(wval2);
SPI.transfer(wval3);
SPI.transfer(wval4);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
//datagram2 - response
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
val0 = SPI.transfer(0);
val1 = SPI.transfer(0);
val2 = SPI.transfer(0);
val3 = SPI.transfer(0);
val4 = SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
MYSERIAL.print("WriteRead 0x");
MYSERIAL.print(address,HEX);
MYSERIAL.print(" Status:");
MYSERIAL.print(val0 & 0b00000111,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val1,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val2,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val3,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val4,BIN);
val32 = (uint32_t)val1<<24 | (uint32_t)val2<<16 | (uint32_t)val3<<8 | (uint32_t)val4;
MYSERIAL.print(" 0x");
MYSERIAL.println(val32,HEX);
}
uint8_t tmc2130_read8(uint8_t chipselect, uint8_t address){
//datagram1 - write
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
uint8_t val0;
//datagram2 - response
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
val0 = SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
return val0;
}
uint32_t tmc2130_readRegister(uint8_t chipselect, uint8_t address){
//datagram1 - write
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
uint32_t val0;
//datagram2 - response
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(0); // ignore status bits
val0 = SPI.transfer(0); // MSB
val0 = (val0 << 8) | SPI.transfer(0);
val0 = (val0 << 8) | SPI.transfer(0);
val0 = (val0 << 8) | SPI.transfer(0); //LSB
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
return val0;
}
uint16_t tmc2130_readSG(uint8_t chipselect){
uint8_t address = 0x6F;
uint32_t registerValue = tmc2130_readRegister(chipselect, address);
uint16_t val0 = registerValue & 0x3ff;
return val0;
}
uint16_t tmc2130_readTStep(uint8_t chipselect){
uint8_t address = 0x12;
uint32_t registerValue = tmc2130_readRegister(chipselect, address);
uint16_t val0 = 0;
if(registerValue & 0x000f0000)
val0 = 0xffff;
else
val0 = registerValue & 0xffff;
return val0;
}
void tmc2130_chopconf(uint8_t cs, bool extrapolate256 = 0, uint16_t microstep_resolution = 16)
{
uint8_t mres=0b0100;
if(microstep_resolution == 256) mres = 0b0000;
if(microstep_resolution == 128) mres = 0b0001;
if(microstep_resolution == 64) mres = 0b0010;
if(microstep_resolution == 32) mres = 0b0011;
if(microstep_resolution == 16) mres = 0b0100;
if(microstep_resolution == 8) mres = 0b0101;
if(microstep_resolution == 4) mres = 0b0110;
if(microstep_resolution == 2) mres = 0b0111;
if(microstep_resolution == 1) mres = 0b1000;
mres |= extrapolate256 << 4; //bit28 intpol
//tmc2130_write(cs,0x6C,mres,0x01,0x00,0xD3);
tmc2130_write(cs,0x6C,mres,0x01,0x00,0xC3);
}
void tmc2130_PWMconf(uint8_t cs, uint8_t PWMautoScale = PWM_AUTOSCALE, uint8_t PWMfreq = PWM_FREQ, uint8_t PWMgrad = PWM_GRAD, uint8_t PWMampl = PWM_AMPL)
{
tmc2130_write(cs,0x70,0x00,(PWMautoScale+PWMfreq),PWMgrad,PWMampl); // TMC LJ -> For better readability changed to 0x00 and added PWMautoScale and PWMfreq
}
void tmc2130_PWMthreshold(uint8_t cs)
{
tmc2130_write(cs,0x13,0x00,0x00,0x00,0x00); // TMC LJ -> Adds possibility to swtich from stealthChop to spreadCycle automatically
}
void st_setSGHoming(uint8_t axis){
sg_homing_axis = axis;
}
void st_resetSGflags(){
sg_axis_stalled[X_AXIS] = false;
sg_axis_stalled[Y_AXIS] = false;
}
uint8_t st_didLastHomingStall(){
uint8_t returnValue = sg_lastHomingStalled;
sg_lastHomingStalled = false;
return returnValue;
}
void tmc2130_disable_motor(uint8_t driver)
{
uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS };
tmc2130_write(cs[driver],0x6C,0,01,0,0);
}
void tmc2130_check_overtemp()
{
const static char TMC_OVERTEMP_MSG[] PROGMEM = "TMC DRIVER OVERTEMP ";
uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS };
static uint32_t checktime = 0;
//drivers_disabled[0] = 1; //TEST
if( millis() - checktime > 1000 ) {
for(int i=0;i<4;i++) {
uint32_t drv_status = tmc2130_read(cs[i], 0x6F); //0x6F DRV_STATUS
if(drv_status & ((uint32_t)1<<26)) { // BIT 26 - over temp prewarning ~120C (+-20C)
SERIAL_ERRORRPGM(TMC_OVERTEMP_MSG);
SERIAL_ECHOLN(i);
for(int x=0; x<4;x++) tmc2130_disable_motor(x);
kill(TMC_OVERTEMP_MSG);
}
}
checktime = millis();
}
}
#endif //HAVE_TMC2130_DRIVERS
void tmc2130_init()
{
#ifdef HAVE_TMC2130_DRIVERS
uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS };
uint8_t current[4] = { 31, 31, 31, 31 };
WRITE(X_TMC2130_CS, HIGH);
WRITE(Y_TMC2130_CS, HIGH);
WRITE(Z_TMC2130_CS, HIGH);
WRITE(E0_TMC2130_CS, HIGH);
SET_OUTPUT(X_TMC2130_CS);
SET_OUTPUT(Y_TMC2130_CS);
SET_OUTPUT(Z_TMC2130_CS);
SET_OUTPUT(E0_TMC2130_CS);
SPI.begin();
for(int i=0;i<4;i++)
{
//tmc2130_write(cs[i],0x6C,0b10100,01,00,0xC5);
tmc2130_chopconf(cs[i],1,16);
tmc2130_write(cs[i],0x10,0,15,current[i],current[i]); //0x10 IHOLD_IRUN
//tmc2130_write(cs[i],0x0,0,0,0,0x05); //address=0x0 GCONF EXT VREF
tmc2130_write(cs[i],0x0,0,0,0,0x05); //address=0x0 GCONF EXT VREF - activate stealthChop
//tmc2130_write(cs[i],0x11,0,0,0,0xA);
// Uncomment lines below to use a different configuration (pwm_autoscale = 0) for XY axes
// if(i==0 || i==1)
// tmc2130_PWMconf(cs[i],PWM_AUTOSCALE_XY,PWM_FREQ_XY,PWM_GRAD_XY,PWM_AMPL_XY); //address=0x70 PWM_CONF //reset default=0x00050480
// else
tmc2130_PWMconf(cs[i]); //address=0x70 PWM_CONF //reset default=0x00050480
tmc2130_PWMthreshold(cs[i]);
}
tmc2130_chopconf(cs[3],0,256);
#endif
}
void st_init()
{
tmc2130_init(); //Initialize TMC2130 drivers
#ifdef HAVE_TMC2130_DRIVERS
tmc2130_init();
#endif //HAVE_TMC2130_DRIVERS
digipot_init(); //Initialize Digipot Motor Current
microstep_init(); //Initialize Microstepping Pins
@ -1163,53 +864,14 @@ void st_init()
// Block until all buffered steps are executed
void st_synchronize()
{
uint8_t delay = 0;
while( blocks_queued()) {
manage_heater();
// Vojtech: Don't disable motors inside the planner!
manage_inactivity(true);
lcd_update();
if(sg_homing_axis == X_AXIS || sg_homing_axis == Y_AXIS)
{
uint8_t axis;
if(sg_homing_axis == X_AXIS)
axis = X_TMC2130_CS;
else
axis = Y_TMC2130_CS;
uint16_t tstep = tmc2130_readTStep(axis);
// SERIAL_PROTOCOLLN(tstep);
if(tstep < TCOOLTHRS)
{
if(delay < 255) // wait for a few tens microsteps until stallGuard is used //todo: read out microsteps directly, instead of delay counter
delay++;
else
{
uint16_t sg = tmc2130_readSG(axis);
if(sg==0)
{
sg_axis_stalled[sg_homing_axis] = true;
sg_lastHomingStalled = true;
}
else
sg_axis_stalled[sg_homing_axis] = false;
// SERIAL_PROTOCOLLN(sg);
}
}
else
{
sg_axis_stalled[sg_homing_axis] = false;
delay = 0;
}
}
else
{
sg_axis_stalled[X_AXIS] = false;
sg_axis_stalled[Y_AXIS] = false;
}
while( blocks_queued()) {
manage_heater();
// Vojtech: Don't disable motors inside the planner!
manage_inactivity(true);
lcd_update();
#ifdef HAVE_TMC2130_DRIVERS
tmc2130_st_synchronize();
#endif //HAVE_TMC2130_DRIVERS
}
}
@ -1512,3 +1174,15 @@ void microstep_readings()
#endif
}
static void check_fans() {
if (READ(TACH_0) != fan_state[0]) {
fan_edge_counter[0] ++;
fan_state[0] = READ(TACH_0);
}
if (READ(TACH_1) != fan_state[1]) {
fan_edge_counter[1] ++;
fan_state[1] = READ(TACH_1);
}
}

View file

@ -88,10 +88,12 @@ void digipot_current(uint8_t driver, int current);
void microstep_init();
void microstep_readings();
static void check_fans();
#ifdef HAVE_TMC2130_DRIVERS
void tmc2130_check_overtemp();
void tmc2130_write(uint8_t chipselect, uint8_t address,uint8_t wval1,uint8_t wval2,uint8_t wval3,uint8_t wval4);
void tmc2130_write(uint8_t chipselect, uint8_t address, uint8_t wval1, uint8_t wval2, uint8_t wval3, uint8_t wval4);
uint8_t tmc2130_read8(uint8_t chipselect, uint8_t address);
uint16_t tmc2130_readSG(uint8_t chipselect);
uint16_t tmc2130_readTStep(uint8_t chipselect);
@ -103,6 +105,7 @@ uint8_t st_didLastHomingStall();
#endif
#ifdef BABYSTEPPING
void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention
#endif

File diff suppressed because it is too large Load diff

View file

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

View file

@ -1033,7 +1033,9 @@ const short temptable_12[][2] PROGMEM = {
#define PtA 3.9083E-3
#define PtB -5.775E-7
#define PtC -4.183E-12
#define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T)))
#define PtRtNew(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T) + (T-100)*PtC*(T)*(T)*(T)))
#define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
#define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T },
@ -1061,6 +1063,124 @@ const short temptable_147[][2] PROGMEM = {
PtLine(300,100,4700)
};
#endif
// E3D Pt100 with 4k7 MiniRambo pullup, no Amp on the MiniRambo v1.3a
#if (THERMISTORHEATER_0 == 148) || (THERMISTORHEATER_1 == 148) || (THERMISTORHEATER_2 == 148) || (THERMISTORBED == 148)
const short temptable_148[][2] PROGMEM = {
// These values have been calculated and tested over many days. See https://docs.google.com/spreadsheets/d/1MJXa6feEe0mGVCT2TrBwLxVOMoLDkJlvfQ4JXhAdV_E
// Values that are missing from the 5C gap are missing due to resolution limits.
{19.00000 * OVERSAMPLENR, 0},
{19.25000 * OVERSAMPLENR, 5},
{19.50000 * OVERSAMPLENR, 10},
{19.87500 * OVERSAMPLENR, 15},
{20.25000 * OVERSAMPLENR, 20},
{21.00000 * OVERSAMPLENR, 25},
{21.75000 * OVERSAMPLENR, 35},
{22.00000 * OVERSAMPLENR, 40},
{23.00000 * OVERSAMPLENR, 50}, // 55C is more commonly used.
{23.75000 * OVERSAMPLENR, 60},
{24.00000 * OVERSAMPLENR, 65},
{24.06250 * OVERSAMPLENR, 70},
{25.00000 * OVERSAMPLENR, 75},
{25.50000 * OVERSAMPLENR, 85},
{26.00000 * OVERSAMPLENR, 90},
{26.93750 * OVERSAMPLENR,100},
{27.00000 * OVERSAMPLENR,105},
{27.37500 * OVERSAMPLENR,110},
{28.00000 * OVERSAMPLENR,115},
{29.00000 * OVERSAMPLENR,125},
{29.25000 * OVERSAMPLENR,135},
{30.00000 * OVERSAMPLENR,140},
{35.50000 * OVERSAMPLENR,150},
{31.00000 * OVERSAMPLENR,155},
{32.00000 * OVERSAMPLENR,165},
{32.18750 * OVERSAMPLENR,175},
{33.00000 * OVERSAMPLENR,180},
{33.62500 * OVERSAMPLENR,190},
{34.00000 * OVERSAMPLENR,195},
{35.00000 * OVERSAMPLENR,205},
{35.50000 * OVERSAMPLENR,215},
{36.00000 * OVERSAMPLENR,220},
{36.75000 * OVERSAMPLENR,230},
{37.00000 * OVERSAMPLENR,235},
{37.75000 * OVERSAMPLENR,245},
{38.00000 * OVERSAMPLENR,250},
{38.12500 * OVERSAMPLENR,255},
{39.00000 * OVERSAMPLENR,260},
{40.00000 * OVERSAMPLENR,275},
{40.25000 * OVERSAMPLENR,285},
{41.00000 * OVERSAMPLENR,290},
{41.25000 * OVERSAMPLENR,300},
{42.00000 * OVERSAMPLENR,305},
{43.00000 * OVERSAMPLENR,315},
{43.25000 * OVERSAMPLENR,325},
{44.00000 * OVERSAMPLENR,330},
{44.18750 * OVERSAMPLENR,340},
{45.00000 * OVERSAMPLENR,345},
{45.25000 * OVERSAMPLENR,355},
{46.00000 * OVERSAMPLENR,360},
{46.62500 * OVERSAMPLENR,370},
{47.00000 * OVERSAMPLENR,375},
{47.25000 * OVERSAMPLENR,385},
{48.00000 * OVERSAMPLENR,390},
{48.75000 * OVERSAMPLENR,400},
{49.00000 * OVERSAMPLENR,405},
};
#endif
#if (THERMISTORHEATER_0 == 247) || (THERMISTORHEATER_1 == 247) || (THERMISTORHEATER_2 == 247) || (THERMISTORBED == 247) // Pt100 with 4k7 MiniRambo pullup & PT100 Amplifier
const short temptable_247[][2] PROGMEM = {
// Calculated from Bob-the-Kuhn's PT100 calculator listed in https://github.com/MarlinFirmware/Marlin/issues/5543
// and the table provided by E3D at http://wiki.e3d-online.com/wiki/E3D_PT100_Amplifier_Documentation#Output_Characteristics.
{ 0 * OVERSAMPLENR, 0},
{241 * OVERSAMPLENR, 1},
{249 * OVERSAMPLENR, 10},
{259 * OVERSAMPLENR, 20},
{267 * OVERSAMPLENR, 30},
{275 * OVERSAMPLENR, 40},
{283 * OVERSAMPLENR, 50},
{291 * OVERSAMPLENR, 60},
{299 * OVERSAMPLENR, 70},
{307 * OVERSAMPLENR, 80},
{315 * OVERSAMPLENR, 90},
{323 * OVERSAMPLENR, 100},
{331 * OVERSAMPLENR, 110},
{340 * OVERSAMPLENR, 120},
{348 * OVERSAMPLENR, 130},
{354 * OVERSAMPLENR, 140},
{362 * OVERSAMPLENR, 150},
{370 * OVERSAMPLENR, 160},
{378 * OVERSAMPLENR, 170},
{386 * OVERSAMPLENR, 180},
{394 * OVERSAMPLENR, 190},
{402 * OVERSAMPLENR, 200},
{410 * OVERSAMPLENR, 210},
{418 * OVERSAMPLENR, 220},
{426 * OVERSAMPLENR, 230},
{432 * OVERSAMPLENR, 240},
{440 * OVERSAMPLENR, 250},
{448 * OVERSAMPLENR, 260},
{454 * OVERSAMPLENR, 270},
{462 * OVERSAMPLENR, 280},
{469 * OVERSAMPLENR, 290},
{475 * OVERSAMPLENR, 300},
{483 * OVERSAMPLENR, 310},
{491 * OVERSAMPLENR, 320},
{499 * OVERSAMPLENR, 330},
{505 * OVERSAMPLENR, 340},
{513 * OVERSAMPLENR, 350},
{519 * OVERSAMPLENR, 360},
{527 * OVERSAMPLENR, 370},
{533 * OVERSAMPLENR, 380},
{541 * OVERSAMPLENR, 390},
{549 * OVERSAMPLENR, 400},
{616 * OVERSAMPLENR, 500},
{682 * OVERSAMPLENR, 600},
{741 * OVERSAMPLENR, 700},
{801 * OVERSAMPLENR, 800},
{856 * OVERSAMPLENR, 900},
{910 * OVERSAMPLENR, 1000},
{960 * OVERSAMPLENR, 1100},
};
#endif
#if (THERMISTORHEATER_0 == 1010) || (THERMISTORHEATER_1 == 1010) || (THERMISTORHEATER_2 == 1010) || (THERMISTORBED == 1010) // Pt1000 with 1k0 pullup
const short temptable_1010[][2] PROGMEM = {
PtLine(0,1000,1000)

364
Firmware/tmc2130.cpp Normal file
View file

@ -0,0 +1,364 @@
#include "Marlin.h"
#ifdef HAVE_TMC2130_DRIVERS
#include "tmc2130.h"
#include <SPI.h>
uint32_t tmc2130_read(uint8_t chipselect, uint8_t address)
{
uint32_t val32;
uint8_t val0;
uint8_t val1;
uint8_t val2;
uint8_t val3;
uint8_t val4;
//datagram1 - read request (address + dummy write)
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address);
SPI.transfer(0);
SPI.transfer(0);
SPI.transfer(0);
SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
//datagram2 - response
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
val0 = SPI.transfer(0);
val1 = SPI.transfer(0);
val2 = SPI.transfer(0);
val3 = SPI.transfer(0);
val4 = SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
#ifdef TMC_DBG_READS
MYSERIAL.print("SPIRead 0x");
MYSERIAL.print(address,HEX);
MYSERIAL.print(" Status:");
MYSERIAL.print(val0 & 0b00000111,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val1,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val2,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val3,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val4,BIN);
#endif
val32 = (uint32_t)val1<<24 | (uint32_t)val2<<16 | (uint32_t)val3<<8 | (uint32_t)val4;
#ifdef TMC_DBG_READS
MYSERIAL.print(" 0x");
MYSERIAL.println(val32,HEX);
#endif
return val32;
}
void tmc2130_write(uint8_t chipselect, uint8_t address,uint8_t wval1,uint8_t wval2,uint8_t wval3,uint8_t wval4)
{
uint32_t val32;
uint8_t val0;
uint8_t val1;
uint8_t val2;
uint8_t val3;
uint8_t val4;
//datagram1 - write
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address+0x80);
SPI.transfer(wval1);
SPI.transfer(wval2);
SPI.transfer(wval3);
SPI.transfer(wval4);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
//datagram2 - response
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
val0 = SPI.transfer(0);
val1 = SPI.transfer(0);
val2 = SPI.transfer(0);
val3 = SPI.transfer(0);
val4 = SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
#ifdef TMC_DBG_WRITE
MYSERIAL.print("WriteRead 0x");
MYSERIAL.print(address,HEX);
MYSERIAL.print(" Status:");
MYSERIAL.print(val0 & 0b00000111,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val1,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val2,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val3,BIN);
MYSERIAL.print(" ");
MYSERIAL.print(val4,BIN);
val32 = (uint32_t)val1<<24 | (uint32_t)val2<<16 | (uint32_t)val3<<8 | (uint32_t)val4;
MYSERIAL.print(" 0x");
MYSERIAL.println(val32,HEX);
#endif //TMC_DBG_READS
}
uint8_t tmc2130_read8(uint8_t chipselect, uint8_t address)
{
//datagram1 - write
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
uint8_t val0;
//datagram2 - response
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
val0 = SPI.transfer(0);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
return val0;
}
uint32_t tmc2130_readRegister(uint8_t chipselect, uint8_t address)
{
//datagram1 - write
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(address);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
uint32_t val0;
//datagram2 - response
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
digitalWrite(chipselect,LOW);
SPI.transfer(0); // ignore status bits
val0 = SPI.transfer(0); // MSB
val0 = (val0 << 8) | SPI.transfer(0);
val0 = (val0 << 8) | SPI.transfer(0);
val0 = (val0 << 8) | SPI.transfer(0); //LSB
digitalWrite(chipselect, HIGH);
SPI.endTransaction();
return val0;
}
uint16_t tmc2130_readSG(uint8_t chipselect)
{
uint8_t address = 0x6F;
uint32_t registerValue = tmc2130_readRegister(chipselect, address);
uint16_t val0 = registerValue & 0x3ff;
return val0;
}
uint16_t tmc2130_readTStep(uint8_t chipselect)
{
uint8_t address = 0x12;
uint32_t registerValue = tmc2130_readRegister(chipselect, address);
uint16_t val0 = 0;
if(registerValue & 0x000f0000)
val0 = 0xffff;
else
val0 = registerValue & 0xffff;
return val0;
}
void tmc2130_chopconf(uint8_t cs, bool extrapolate256 = 0, uint16_t microstep_resolution = 16)
{
uint8_t mres=0b0100;
if(microstep_resolution == 256) mres = 0b0000;
if(microstep_resolution == 128) mres = 0b0001;
if(microstep_resolution == 64) mres = 0b0010;
if(microstep_resolution == 32) mres = 0b0011;
if(microstep_resolution == 16) mres = 0b0100;
if(microstep_resolution == 8) mres = 0b0101;
if(microstep_resolution == 4) mres = 0b0110;
if(microstep_resolution == 2) mres = 0b0111;
if(microstep_resolution == 1) mres = 0b1000;
mres |= extrapolate256 << 4; //bit28 intpol
//tmc2130_write(cs,0x6C,mres,0x01,0x00,0xD3);
tmc2130_write(cs,0x6C,mres,0x01,0x00,0xC3);
}
void tmc2130_PWMconf(uint8_t cs, uint8_t PWMautoScale = PWM_AUTOSCALE, uint8_t PWMfreq = PWM_FREQ, uint8_t PWMgrad = PWM_GRAD, uint8_t PWMampl = PWM_AMPL)
{
tmc2130_write(cs,0x70,0x00,(PWMautoScale+PWMfreq),PWMgrad,PWMampl); // TMC LJ -> For better readability changed to 0x00 and added PWMautoScale and PWMfreq
}
void tmc2130_PWMthreshold(uint8_t cs)
{
tmc2130_write(cs,0x13,0x00,0x00,0x00,0x00); // TMC LJ -> Adds possibility to swtich from stealthChop to spreadCycle automatically
}
uint8_t st_didLastHomingStall()
{
uint8_t returnValue = sg_lastHomingStalled;
sg_lastHomingStalled = false;
return returnValue;
}
void tmc2130_disable_motor(uint8_t driver)
{
uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS };
tmc2130_write(cs[driver],0x6C,0,01,0,0);
}
void tmc2130_check_overtemp()
{
const static char TMC_OVERTEMP_MSG[] PROGMEM = "TMC DRIVER OVERTEMP ";
uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS };
static uint32_t checktime = 0;
//drivers_disabled[0] = 1; //TEST
if( millis() - checktime > 1000 )
{
for(int i=0;i<4;i++)
{
uint32_t drv_status = tmc2130_read(cs[i], 0x6F); //0x6F DRV_STATUS
if (drv_status & ((uint32_t)1<<26))
{ // BIT 26 - over temp prewarning ~120C (+-20C)
SERIAL_ERRORRPGM(TMC_OVERTEMP_MSG);
SERIAL_ECHOLN(i);
for(int x=0; x<4;x++) tmc2130_disable_motor(x);
kill(TMC_OVERTEMP_MSG);
}
}
checktime = millis();
}
}
void tmc2130_init()
{
uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS };
// uint8_t current[4] = { 31, 31, 31, 31 };
// uint8_t current_h[4] = { 12, 12, 12, 12 };
// uint8_t current_r[4] = { 24, 24, 24, 24 };
// uint8_t current_r[4] = { 32, 32, 32, 32 };
// uint8_t current_h[4] = { 14, 14, 14, 14 };
uint8_t current_h[4] = { 2, 2, 2, 4 };
uint8_t current_r[4] = { 6, 6, 8, 8 };
WRITE(X_TMC2130_CS, HIGH);
WRITE(Y_TMC2130_CS, HIGH);
WRITE(Z_TMC2130_CS, HIGH);
WRITE(E0_TMC2130_CS, HIGH);
SET_OUTPUT(X_TMC2130_CS);
SET_OUTPUT(Y_TMC2130_CS);
SET_OUTPUT(Z_TMC2130_CS);
SET_OUTPUT(E0_TMC2130_CS);
SPI.begin();
/* for(int i=0;i<4;i++)
{
//tmc2130_write(cs[i],0x6C,0b10100,01,00,0xC5);
tmc2130_chopconf(cs[i],1,16);
tmc2130_write(cs[i],0x10,0,15,current_h[i],current_r[i]); //0x10 IHOLD_IRUN
//tmc2130_write(cs[i],0x0,0,0,0,0x05); //address=0x0 GCONF EXT VREF
tmc2130_write(cs[i],0x0,0,0,0,0x05); //address=0x0 GCONF EXT VREF - activate stealthChop
//tmc2130_write(cs[i],0x11,0,0,0,0xA);
// Uncomment lines below to use a different configuration (pwm_autoscale = 0) for XY axes
if(i==0 || i==1)
tmc2130_PWMconf(cs[i],PWM_AUTOSCALE_XY,PWM_FREQ_XY,PWM_GRAD_XY,PWM_AMPL_XY); //address=0x70 PWM_CONF //reset default=0x00050480
else
tmc2130_PWMconf(cs[i]); //address=0x70 PWM_CONF //reset default=0x00050480
tmc2130_PWMthreshold(cs[i]);
}
*/
#ifdef MK3_TEST1
for (int i=0;i<4;i++)
{
tmc2130_write(cs[i],0x0,0,0,0,0x00); //address=0x0 GCONF - bit 2 activate stealthChop
tmc2130_write(cs[i],0x10,0,15,current_r[i],current_h[i]); //0x10 IHOLD_IRUN
tmc2130_chopconf(cs[i],0,16);
}
#else //MK3_TEST1
for (int i=0;i<3;i++)
{
tmc2130_write(cs[i],0x0,0,0,0,0x04); //address=0x0 GCONF - bit 2 activate stealthChop
tmc2130_write(cs[i],0x10,0,15,current_r[i],current_h[i]); //0x10 IHOLD_IRUN
tmc2130_write(cs[i],0x11,0,0,0,0);
tmc2130_PWMconf(cs[i]); //address=0x70 PWM_CONF //reset default=0x00050480
// tmc2130_PWMthreshold(cs[i]);
tmc2130_chopconf(cs[i],1,16);
}
for (int i=3;i<4;i++)
{
tmc2130_write(cs[i],0x0,0,0,0,0x00); //address=0x0 GCONF - bit 2 activate stealthChop
tmc2130_write(cs[i],0x10,0,15,current_r[i],current_h[i]); //0x10 IHOLD_IRUN
tmc2130_write(cs[i],0x11,0,0,0,0);
tmc2130_chopconf(cs[i],1,16);
}
#endif //MK3_TEST1
}
void tmc2130_st_synchronize()
{
uint8_t delay = 0;
if(sg_homing_axis == X_AXIS || sg_homing_axis == Y_AXIS)
{
uint8_t axis;
if(sg_homing_axis == X_AXIS)
axis = X_TMC2130_CS;
else
axis = Y_TMC2130_CS;
uint16_t tstep = tmc2130_readTStep(axis);
// SERIAL_PROTOCOLLN(tstep);
if(tstep < TCOOLTHRS)
{
if(delay < 255) // wait for a few tens microsteps until stallGuard is used //todo: read out microsteps directly, instead of delay counter
delay++;
else
{
uint16_t sg = tmc2130_readSG(axis);
if(sg==0)
{
sg_axis_stalled[sg_homing_axis] = true;
sg_lastHomingStalled = true;
}
else
sg_axis_stalled[sg_homing_axis] = false;
// SERIAL_PROTOCOLLN(sg);
}
}
else
{
sg_axis_stalled[sg_homing_axis] = false;
delay = 0;
}
}
else
{
sg_axis_stalled[X_AXIS] = false;
sg_axis_stalled[Y_AXIS] = false;
}
}
void tmc2130_st_home_enter(uint8_t axis)
{
sg_homing_axis = axis;
// Configuration to spreadCycle
// tmc2130_write((axis == X_AXIS)? X_TMC2130_CS : Y_TMC2130_CS,0x0,0,0,0,0x01);
tmc2130_write((axis == X_AXIS)? X_TMC2130_CS : Y_TMC2130_CS,0x0,0,0,0,0x00);
tmc2130_write((axis == X_AXIS)? X_TMC2130_CS : Y_TMC2130_CS,0x6D,0,(axis == X_AXIS)?SG_THRESHOLD_X:SG_THRESHOLD_Y,0,0);
tmc2130_write((axis == X_AXIS)? X_TMC2130_CS : Y_TMC2130_CS,0x14,0,0,0,TCOOLTHRS);
}
void tmc2130_st_home_exit()
{
if ((sg_homing_axis == X_AXIS) || (sg_homing_axis == X_AXIS))
{
// Configuration back to stealthChop
tmc2130_write((sg_homing_axis == X_AXIS)? X_TMC2130_CS : Y_TMC2130_CS, 0x0, 0, 0, 0, 0x04);
sg_homing_axis = 0xff;
sg_axis_stalled[X_AXIS] = false;
sg_axis_stalled[Y_AXIS] = false;
}
}
#endif //HAVE_TMC2130_DRIVERS

26
Firmware/tmc2130.h Normal file
View file

@ -0,0 +1,26 @@
#ifndef TMC2130_H
#define TMC2130_H
static uint8_t sg_homing_axis = 0xFF;
static uint8_t sg_axis_stalled[2] = {0, 0};
static uint8_t sg_lastHomingStalled = false;
void tmc2130_check_overtemp();
void tmc2130_write(uint8_t chipselect, uint8_t address,uint8_t wval1,uint8_t wval2,uint8_t wval3,uint8_t wval4);
uint8_t tmc2130_read8(uint8_t chipselect, uint8_t address);
uint16_t tmc2130_readSG(uint8_t chipselect);
uint16_t tmc2130_readTStep(uint8_t chipselect);
void tmc2130_PWMconf(uint8_t cs, uint8_t PWMgrad, uint8_t PWMampl);
uint8_t st_didLastHomingStall();
void tmc2130_st_synchronize();
void tmc2130_st_home_enter(uint8_t axis);
void tmc2130_st_home_exit();
void tmc2130_init();
#endif TMC2130_H

File diff suppressed because it is too large Load diff

View file

@ -91,6 +91,9 @@ void lcd_mylang();
#define LCD_COMMAND_LOAD_FILAMENT 1
#define LCD_COMMAND_STOP_PRINT 2
#define LCD_COMMAND_FARM_MODE_CONFIRM 4
#define LCD_COMMAND_LONG_PAUSE 5
#define LCD_COMMAND_LONG_PAUSE_RESUME 6
#define LCD_COMMAND_PID_EXTRUDER 7
extern unsigned long lcd_timeoutToStatus;
extern int lcd_commands_type;
@ -100,7 +103,12 @@ void lcd_mylang();
extern int farm_timer;
extern int farm_status;
#ifdef SNMM
extern uint8_t snmm_extruder;
#endif // SNMM
extern bool cancel_heatup;
extern bool isPrintPaused;
#ifdef FILAMENT_LCD_DISPLAY
extern unsigned long message_millis;
@ -200,6 +208,7 @@ extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str);
void change_extr(int extr);
static void lcd_colorprint_change();
static int get_ext_nr();
static void extr_adj(int extruder);
static void extr_adj_0();
@ -213,6 +222,10 @@ static void extr_unload_1();
static void extr_unload_2();
static void extr_unload_3();
static void lcd_disable_farm_mode();
void extr_unload_all();
void extr_unload_used();
void extr_unload();
static char snmm_stop_print_menu();
void stack_error();
static void lcd_ping_allert();
@ -233,5 +246,16 @@ void lcd_extr_cal_reset();
union MenuData;
void bowden_menu();
char reset_menu();
char choose_extruder_menu();
void lcd_pinda_calibration_menu();
void lcd_calibrate_pinda();
void lcd_temp_calibration_set();
void display_loading();
void lcd_service_mode_show_result();
#endif //ULTRALCD_H

View file

@ -710,6 +710,12 @@ static void lcd_implementation_status_screen()
lcd.print(LCD_STR_FEEDRATE[0]);
lcd.print(itostr3(feedmultiply));
lcd_printPGM(PSTR("% "));
lcd.setCursor(8, 0);
lcd.print(itostr3(fan_speed[0]));
lcd.setCursor(8, 1);
lcd.print(itostr3(fan_speed[1]));
#else
//Print Feedrate
lcd.setCursor(LCD_WIDTH - 8-2, 1);
@ -776,15 +782,17 @@ static void lcd_implementation_status_screen()
}
else {
lcd.setCursor(LCD_WIDTH - 8 - 2, 2);
lcd_printPGM(PSTR(" "));
}
#ifdef SNMM
lcd_printPGM(PSTR(" E"));
lcd.print(get_ext_nr()+1);
lcd.print(get_ext_nr() + 1);
#else
lcd.setCursor(LCD_WIDTH - 8 - 2, 2);
lcd_printPGM(PSTR(" "));
#endif
}
//Print time elapsed
lcd.setCursor(LCD_WIDTH - 8 -1, 2);
@ -792,7 +800,7 @@ static void lcd_implementation_status_screen()
lcd.print(LCD_STR_CLOCK[0]);
if(starttime != 0)
{
uint16_t time = millis()/60000 - starttime/60000;
uint16_t time = millis() / 60000 - starttime / 60000;
lcd.print(itostr2(time/60));
lcd.print(':');
lcd.print(itostr2(time%60));
@ -948,6 +956,39 @@ static void lcd_implementation_status_screen()
{
lcd.print(lcd_status_message);
}
// PID tuning in progress
if (custom_message_type == 3) {
lcd.print(lcd_status_message);
if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) {
lcd.setCursor(10, 3);
lcd.print(itostr3(pid_cycle));
lcd.print('/');
lcd.print(itostr3left(pid_number_of_cycles));
}
}
// PINDA temp calibration in progress
if (custom_message_type == 4) {
char progress[4];
lcd.setCursor(0, 3);
lcd_printPGM(MSG_TEMP_CALIBRATION);
lcd.setCursor(12, 3);
sprintf(progress, "%d/6", custom_message_state);
lcd.print(progress);
}
// temp compensation preheat
if (custom_message_type == 5) {
lcd.setCursor(0, 3);
lcd_printPGM(MSG_PINDA_PREHEAT);
if (custom_message_state <= PINDA_HEAT_T) {
lcd_printPGM(PSTR(": "));
lcd.print(custom_message_state); //seconds
lcd.print(' ');
}
}
}
else
{

View file

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

View file

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

View file

@ -17,7 +17,15 @@
// Electronics
#define MOTHERBOARD BOARD_EINY_0_1a
//#define MOTHERBOARD BOARD_RAMBO_MINI_1_0
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
//#define E3D_PT100_EXTRUDER_WITH_AMP
//#define E3D_PT100_EXTRUDER_NO_AMP
//#define E3D_PT100_BED_WITH_AMP
//#define E3D_PT100_BED_NO_AMP
/*------------------------------------
AXIS SETTINGS
@ -48,6 +56,11 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define X_CANCEL_POS 50
#define Y_CANCEL_POS 190
//Pause print position
#define X_PAUSE_POS 50
#define Y_PAUSE_POS 190
#define Z_PAUSE_LIFT 20
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000
@ -86,6 +99,30 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define TMC_DEBUG
// PWM register configuration
#define PWM_GRAD 0x08 // 0x0F - Sets gradient - (max 15 with PWM autoscale activated)
#define PWM_AMPL 0xC8 // 0xFF - Sets PWM amplitude to 200 (max is 255)
#define PWM_AUTOSCALE 0x04 // 0x04 since writing in PWM_CONF (Activates PWM autoscaling)
#define PWM_FREQ 0x01 // 0x01 since writing in PWM_CONF (Sets PWM frequency to 2/683 fCLK)
// Special configuration for XY axes for operation (during standstill, use same settings as for other axes) //todo
#define PWM_GRAD_XY 156 // 0x0F - Sets gradient - (max 15 with PWM autoscale activated)
#define PWM_AMPL_XY 63 // 0xFF - Sets PWM amplitude to 200 (max is 255)
#define PWM_AUTOSCALE_XY 0x00 // 0x04 since writing in PWM_CONF (Activates PWM autoscaling)
#define PWM_FREQ_XY 0x01 // 0x01 since writing in PWM_CONF (Sets PWM frequency to 2/683 fCLK)
#define PWM_THRS 0x00 // TPWM_THRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode
#define SG_HOMING 1
#define SG_THRESHOLD_X 8
#define SG_THRESHOLD_Y 8
#define TCOOLTHRS 239
#define TMC_DEBUG
//#define TMC_DBG_READS
//#define TMC_DBG_WRITE
/*------------------------------------
EXTRUDER SETTINGS
*------------------------------------*/
@ -97,15 +134,26 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define BED_MINTEMP 15
// Maxtemps
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
#define HEATER_0_MAXTEMP 410
#else
#define HEATER_0_MAXTEMP 305
#endif
#define HEATER_1_MAXTEMP 305
#define HEATER_2_MAXTEMP 305
#define BED_MAXTEMP 150
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
// Define PID constants for extruder with PT100
#define DEFAULT_Kp 21.70
#define DEFAULT_Ki 1.60
#define DEFAULT_Kd 73.76
#else
// Define PID constants for extruder
#define DEFAULT_Kp 40.925
#define DEFAULT_Ki 4.875
#define DEFAULT_Kd 86.085
#endif
// Extrude mintemp
#define EXTRUDE_MINTEMP 130
@ -214,7 +262,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define MESH_MEAS_NUM_Y_POINTS 3
#define MESH_HOME_Z_CALIB 0.2
#define MESH_HOME_Z_SEARCH 5
#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc.
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind
@ -250,9 +298,16 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#ifdef PIDTEMPBED
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP)
// Define PID constants for extruder with PT100
#define DEFAULT_bedKp 21.70
#define DEFAULT_bedKi 1.60
#define DEFAULT_bedKd 73.76
#else
#define DEFAULT_bedKp 126.13
#define DEFAULT_bedKi 4.30
#define DEFAULT_bedKd 924.76
#endif
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
@ -329,12 +384,26 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// 1047 is Pt1000 with 4k7 pullup
// 1010 is Pt1000 with 1k pullup (non standard)
// 147 is Pt100 with 4k7 pullup
// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a
// 247 is Pt100 with 4k7 pullup and PT100 Amplifier
// 110 is Pt100 with 1k pullup (non standard)
#if defined(E3D_PT100_EXTRUDER_WITH_AMP)
#define TEMP_SENSOR_0 247
#elif defined(E3D_PT100_EXTRUDER_NO_AMP)
#define TEMP_SENSOR_0 148
#else
#define TEMP_SENSOR_0 5
#endif
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#if defined(E3D_PT100_BED_WITH_AMP)
#define TEMP_SENSOR_BED 247
#elif defined(E3D_PT100_BED_NO_AMP)
#define TEMP_SENSOR_BED 148
#else
#define TEMP_SENSOR_BED 1
#endif
#define STACK_GUARD_TEST_VALUE 0xA2A2
@ -344,16 +413,33 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define MAX_E_STEPS_PER_UNIT 250
#define MIN_E_STEPS_PER_UNIT 100
#define PRINT_STARTED 0xFE
#define PRINT_FINISHED 0xFF
#define Z_BABYSTEP_MIN -3999
#define Z_BABYSTEP_MAX 0
#define PINDA_PREHEAT_X 70
#define PINDA_PREHEAT_Y -3
#define PINDA_PREHEAT_Z 1
#define PINDA_HEAT_T 120 //time in s
#define PINDA_MIN_T 50
#define PINDA_STEP_T 10
#define PINDA_MAX_T 100
#define PING_TIME 60 //time in s
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
#define PING_ALLERT_PERIOD 60 //time in s
#define LONG_PRESS_TIME 1000 //time in ms for button long press
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
#define DEFAULT_PID_TEMP 210
#define MIN_PRINT_FAN_SPEED 50
#ifdef SNMM
#define DEFAULT_RETRACTION 4 //used for PINDA temp calibration and pause print
#else
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
#endif
#endif //__CONFIGURATION_PRUSA_H

View file

@ -18,13 +18,27 @@ GENERAL SETTINGS
// Electronics
#define MOTHERBOARD BOARD_RAMBO_MINI_1_0
// Prusa Single extruder multiple material suport
//#define SNMM
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
//#define E3D_PT100_EXTRUDER_WITH_AMP
//#define E3D_PT100_EXTRUDER_NO_AMP
//#define E3D_PT100_BED_WITH_AMP
//#define E3D_PT100_BED_NO_AMP
/*------------------------------------
AXIS SETTINGS
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#ifdef SNMM
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140}
#else
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3}
#endif
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@ -48,6 +62,11 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define X_CANCEL_POS 50
#define Y_CANCEL_POS 190
//Pause print position
#define X_PAUSE_POS 50
#define Y_PAUSE_POS 190
#define Z_PAUSE_LIFT 20
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min)
@ -73,15 +92,26 @@ EXTRUDER SETTINGS
#define BED_MINTEMP 15
// Maxtemps
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
#define HEATER_0_MAXTEMP 410
#else
#define HEATER_0_MAXTEMP 305
#endif
#define HEATER_1_MAXTEMP 305
#define HEATER_2_MAXTEMP 305
#define BED_MAXTEMP 150
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
// Define PID constants for extruder with PT100
#define DEFAULT_Kp 21.70
#define DEFAULT_Ki 1.60
#define DEFAULT_Kd 73.76
#else
// Define PID constants for extruder
#define DEFAULT_Kp 40.925
#define DEFAULT_Ki 4.875
#define DEFAULT_Kd 86.085
#endif
// Extrude mintemp
#define EXTRUDE_MINTEMP 130
@ -98,13 +128,15 @@ EXTRUDER SETTINGS
#ifdef SNMM
//#define BOWDEN_LENGTH 408
#define BOWDEN_LENGTH 457 //total length for filament fast loading part; max length for extrusion is 465 mm!
#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu
#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle
#define FIL_RETURN_LENGTH 30.5 //for filament adjusting (PRUSAY code)
#define FIL_COOLING 10 //length for cooling moves
#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code
#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming
#endif //SNMM
//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function
#endif
/*------------------------------------
CHANGE FILAMENT SETTINGS
@ -143,8 +175,8 @@ ADDITIONAL FEATURES SETTINGS
#endif
// temperature runaway
//#define TEMP_RUNAWAY_BED_HYSTERESIS 5
//#define TEMP_RUNAWAY_BED_TIMEOUT 360
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
@ -188,7 +220,7 @@ BED SETTINGS
#define MESH_MEAS_NUM_Y_POINTS 3
#define MESH_HOME_Z_CALIB 0.2
#define MESH_HOME_Z_SEARCH 5
#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc.
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind
@ -224,9 +256,16 @@ BED SETTINGS
#ifdef PIDTEMPBED
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP)
// Define PID constants for extruder with PT100
#define DEFAULT_bedKp 21.70
#define DEFAULT_bedKi 1.60
#define DEFAULT_bedKd 73.76
#else
#define DEFAULT_bedKp 126.13
#define DEFAULT_bedKi 4.30
#define DEFAULT_bedKd 924.76
#endif
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
@ -303,12 +342,26 @@ THERMISTORS SETTINGS
// 1047 is Pt1000 with 4k7 pullup
// 1010 is Pt1000 with 1k pullup (non standard)
// 147 is Pt100 with 4k7 pullup
// 148 is Pt100 with 4k7 pullup and no PT100 Amplifier (in case type 147 doesn't work)
// 247 is Pt100 with 4k7 pullup and PT100 Amplifier
// 110 is Pt100 with 1k pullup (non standard)
#if defined(E3D_PT100_EXTRUDER_WITH_AMP)
#define TEMP_SENSOR_0 247
#elif defined(E3D_PT100_EXTRUDER_NO_AMP)
#define TEMP_SENSOR_0 148
#else
#define TEMP_SENSOR_0 5
#endif
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#if defined(E3D_PT100_BED_WITH_AMP)
#define TEMP_SENSOR_BED 247
#elif defined(E3D_PT100_BED_NO_AMP)
#define TEMP_SENSOR_BED 148
#else
#define TEMP_SENSOR_BED 1
#endif
#define STACK_GUARD_TEST_VALUE 0xA2A2
@ -318,16 +371,31 @@ THERMISTORS SETTINGS
#define MAX_E_STEPS_PER_UNIT 250
#define MIN_E_STEPS_PER_UNIT 100
#define PRINT_STARTED 0xFE
#define PRINT_FINISHED 0xFF
#define Z_BABYSTEP_MIN -3999
#define Z_BABYSTEP_MAX 0
#define PINDA_PREHEAT_X 70
#define PINDA_PREHEAT_Y -3
#define PINDA_PREHEAT_Z 1
#define PINDA_HEAT_T 120 //time in s
#define PINDA_MIN_T 50
#define PINDA_STEP_T 10
#define PINDA_MAX_T 100
#define PING_TIME 60 //time in s
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
#define PING_ALLERT_PERIOD 60 //time in s
#define LONG_PRESS_TIME 1000 //time in ms for button long press
#define LONG_PRESS_TIME 1000 //time in ms for button long press
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
#define DEFAULT_PID_TEMP 210
#ifdef SNMM
#define DEFAULT_RETRACTION 4 //used for PINDA temp calibration and pause print
#else
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
#endif
#endif //__CONFIGURATION_PRUSA_H

View file

@ -18,13 +18,27 @@ GENERAL SETTINGS
// Electronics
#define MOTHERBOARD BOARD_RAMBO_MINI_1_3
// Prusa Single extruder multiple material suport
//#define SNMM
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
//#define E3D_PT100_EXTRUDER_WITH_AMP
//#define E3D_PT100_EXTRUDER_NO_AMP
//#define E3D_PT100_BED_WITH_AMP
//#define E3D_PT100_BED_NO_AMP
/*------------------------------------
AXIS SETTINGS
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#ifdef SNMM
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140}
#else
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3}
#endif
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@ -48,6 +62,11 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define X_CANCEL_POS 50
#define Y_CANCEL_POS 190
//Pause print position
#define X_PAUSE_POS 50
#define Y_PAUSE_POS 190
#define Z_PAUSE_LIFT 20
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min)
@ -73,15 +92,26 @@ EXTRUDER SETTINGS
#define BED_MINTEMP 15
// Maxtemps
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
#define HEATER_0_MAXTEMP 410
#else
#define HEATER_0_MAXTEMP 305
#endif
#define HEATER_1_MAXTEMP 305
#define HEATER_2_MAXTEMP 305
#define BED_MAXTEMP 150
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
// Define PID constants for extruder with PT100
#define DEFAULT_Kp 21.70
#define DEFAULT_Ki 1.60
#define DEFAULT_Kd 73.76
#else
// Define PID constants for extruder
#define DEFAULT_Kp 40.925
#define DEFAULT_Ki 4.875
#define DEFAULT_Kd 86.085
#endif
// Extrude mintemp
#define EXTRUDE_MINTEMP 130
@ -93,18 +123,22 @@ EXTRUDER SETTINGS
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Prusa Single extruder multiple material suport
//#define SNMM
#ifdef SNMM
//#define BOWDEN_LENGTH 408
#define BOWDEN_LENGTH 457 //total length for filament fast loading part; max length for extrusion is 465 mm!
#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu
#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle
#define FIL_RETURN_LENGTH 30.5 //for filament adjusting (PRUSAY code)
#define FIL_COOLING 10 //length for cooling moves
#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code
#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming
#endif //SNMM
//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function
#endif
/*------------------------------------
CHANGE FILAMENT SETTINGS
@ -143,8 +177,8 @@ ADDITIONAL FEATURES SETTINGS
#endif
// temperature runaway
//#define TEMP_RUNAWAY_BED_HYSTERESIS 5
//#define TEMP_RUNAWAY_BED_TIMEOUT 360
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
@ -188,7 +222,7 @@ BED SETTINGS
#define MESH_MEAS_NUM_Y_POINTS 3
#define MESH_HOME_Z_CALIB 0.2
#define MESH_HOME_Z_SEARCH 5
#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc.
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind
@ -224,9 +258,16 @@ BED SETTINGS
#ifdef PIDTEMPBED
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP)
// Define PID constants for extruder with PT100
#define DEFAULT_bedKp 21.70
#define DEFAULT_bedKi 1.60
#define DEFAULT_bedKd 73.76
#else
#define DEFAULT_bedKp 126.13
#define DEFAULT_bedKi 4.30
#define DEFAULT_bedKd 924.76
#endif
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
@ -303,12 +344,26 @@ THERMISTORS SETTINGS
// 1047 is Pt1000 with 4k7 pullup
// 1010 is Pt1000 with 1k pullup (non standard)
// 147 is Pt100 with 4k7 pullup
// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a
// 247 is Pt100 with 4k7 pullup and PT100 Amplifier
// 110 is Pt100 with 1k pullup (non standard)
#if defined(E3D_PT100_EXTRUDER_WITH_AMP)
#define TEMP_SENSOR_0 247
#elif defined(E3D_PT100_EXTRUDER_NO_AMP)
#define TEMP_SENSOR_0 148
#else
#define TEMP_SENSOR_0 5
#endif
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#if defined(E3D_PT100_BED_WITH_AMP)
#define TEMP_SENSOR_BED 247
#elif defined(E3D_PT100_BED_NO_AMP)
#define TEMP_SENSOR_BED 148
#else
#define TEMP_SENSOR_BED 1
#endif
#define STACK_GUARD_TEST_VALUE 0xA2A2
@ -318,16 +373,31 @@ THERMISTORS SETTINGS
#define MAX_E_STEPS_PER_UNIT 250
#define MIN_E_STEPS_PER_UNIT 100
#define PRINT_STARTED 0xFE
#define PRINT_FINISHED 0xFF
#define Z_BABYSTEP_MIN -3999
#define Z_BABYSTEP_MAX 0
#define PINDA_PREHEAT_X 70
#define PINDA_PREHEAT_Y -3
#define PINDA_PREHEAT_Z 1
#define PINDA_HEAT_T 120 //time in s
#define PINDA_MIN_T 50
#define PINDA_STEP_T 10
#define PINDA_MAX_T 100
#define PING_TIME 60 //time in s
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
#define PING_ALLERT_PERIOD 60 //time in s
#define LONG_PRESS_TIME 1000 //time in ms for button long press
#define LONG_PRESS_TIME 1000 //time in ms for button long press
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
#define DEFAULT_PID_TEMP 210
#ifdef SNMM
#define DEFAULT_RETRACTION 4 //used for PINDA temp calibration and pause print
#else
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
#endif
#endif //__CONFIGURATION_PRUSA_H