Commit 355d2b4d authored by MagoKimbra's avatar MagoKimbra

Add alpha sort files in SD card

parent aad22c23
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
* 10 is 100k RS thermistor 198-961 (4.7k pullup) * 10 is 100k RS thermistor 198-961 (4.7k pullup)
* 11 is 100k beta 3950 1% thermistor (4.7k pullup) * 11 is 100k beta 3950 1% thermistor (4.7k pullup)
* 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) * 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
* 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" * 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
* 20 is the PT100 circuit found in the Ultimainboard V2.x * 20 is the PT100 circuit found in the Ultimainboard V2.x
* 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 * 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
* *
......
...@@ -192,7 +192,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o ...@@ -192,7 +192,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
//// MOVEMENT SETTINGS //// MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {100*60,100*60,4*60,0} // set the homing speeds (mm/min) #define HOMING_FEEDRATE {100*60,100*60,2*60,0} // set the homing speeds (mm/min)
// default settings // default settings
...@@ -244,5 +244,5 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o ...@@ -244,5 +244,5 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. // Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
// //
#define SERVO_ENDSTOPS {-1,-1,0} // Servo index for X, Y, Z. Disable with -1 #define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
#define SERVO_ENDSTOP_ANGLES {0,0,0,0,90,0} // X,Y,Z Axis Extend and Retract angles #define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 90,0} // X,Y,Z Axis Extend and Retract angles
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
//=========================================================================== //===========================================================================
#ifdef BED_LIMIT_SWITCHING #ifdef BED_LIMIT_SWITCHING
#define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#endif #endif
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds
#ifdef PIDTEMP #ifdef PIDTEMP
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE #define PID_ADD_EXTRUSION_RATE
#ifdef PID_ADD_EXTRUSION_RATE #ifdef PID_ADD_EXTRUSION_RATE
#define DEFAULT_Kc (1) //heating power=Kc*(e_speed) #define DEFAULT_Kc (1) //heating power=Kc*(e_speed)
#endif #endif
#endif #endif
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
// on an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode // on an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
#define AUTOTEMP #define AUTOTEMP
#ifdef AUTOTEMP #ifdef AUTOTEMP
#define AUTOTEMP_OLDWEIGHT 0.98 #define AUTOTEMP_OLDWEIGHT 0.98
#endif #endif
//Show Temperature ADC value //Show Temperature ADC value
...@@ -102,46 +102,46 @@ ...@@ -102,46 +102,46 @@
//// AUTOSET LOCATIONS OF LIMIT SWITCHES //// AUTOSET LOCATIONS OF LIMIT SWITCHES
//// Added by ZetaPhoenix 09-15-2012 //// Added by ZetaPhoenix 09-15-2012
#ifdef MANUAL_HOME_POSITIONS // Use manual limit switch locations #ifdef MANUAL_HOME_POSITIONS // Use manual limit switch locations
#define X_HOME_POS MANUAL_X_HOME_POS #define X_HOME_POS MANUAL_X_HOME_POS
#define Y_HOME_POS MANUAL_Y_HOME_POS #define Y_HOME_POS MANUAL_Y_HOME_POS
#define Z_HOME_POS MANUAL_Z_HOME_POS #define Z_HOME_POS MANUAL_Z_HOME_POS
#else //Set min/max homing switch positions based upon homing direction and min/max travel limits #else //Set min/max homing switch positions based upon homing direction and min/max travel limits
//X axis //X axis
#if X_HOME_DIR == -1 #if X_HOME_DIR == -1
#ifdef BED_CENTER_AT_0_0 #ifdef BED_CENTER_AT_0_0
#define X_HOME_POS X_MAX_LENGTH * -0.5 #define X_HOME_POS X_MAX_LENGTH * -0.5
#else #else
#define X_HOME_POS X_MIN_POS #define X_HOME_POS X_MIN_POS
#endif //BED_CENTER_AT_0_0 #endif //BED_CENTER_AT_0_0
#else #else
#ifdef BED_CENTER_AT_0_0 #ifdef BED_CENTER_AT_0_0
#define X_HOME_POS X_MAX_LENGTH * 0.5 #define X_HOME_POS X_MAX_LENGTH * 0.5
#else #else
#define X_HOME_POS X_MAX_POS #define X_HOME_POS X_MAX_POS
#endif //BED_CENTER_AT_0_0 #endif //BED_CENTER_AT_0_0
#endif //X_HOME_DIR == -1 #endif //X_HOME_DIR == -1
//Y axis //Y axis
#if Y_HOME_DIR == -1 #if Y_HOME_DIR == -1
#ifdef BED_CENTER_AT_0_0 #ifdef BED_CENTER_AT_0_0
#define Y_HOME_POS Y_MAX_LENGTH * -0.5 #define Y_HOME_POS Y_MAX_LENGTH * -0.5
#else #else
#define Y_HOME_POS Y_MIN_POS #define Y_HOME_POS Y_MIN_POS
#endif //BED_CENTER_AT_0_0 #endif //BED_CENTER_AT_0_0
#else #else
#ifdef BED_CENTER_AT_0_0 #ifdef BED_CENTER_AT_0_0
#define Y_HOME_POS Y_MAX_LENGTH * 0.5 #define Y_HOME_POS Y_MAX_LENGTH * 0.5
#else #else
#define Y_HOME_POS Y_MAX_POS #define Y_HOME_POS Y_MAX_POS
#endif //BED_CENTER_AT_0_0 #endif //BED_CENTER_AT_0_0
#endif //Y_HOME_DIR == -1 #endif //Y_HOME_DIR == -1
// Z axis // Z axis
#if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
#define Z_HOME_POS Z_MIN_POS #define Z_HOME_POS Z_MIN_POS
#else #else
#define Z_HOME_POS Z_MAX_POS #define Z_HOME_POS Z_MAX_POS
#endif //Z_HOME_DIR == -1 #endif //Z_HOME_DIR == -1
#endif //End auto min/max positions #endif //End auto min/max positions
//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP //END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
...@@ -156,8 +156,8 @@ ...@@ -156,8 +156,8 @@
//#define Z_DUAL_STEPPER_DRIVERS //#define Z_DUAL_STEPPER_DRIVERS
#ifdef Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS #undef EXTRUDERS
#define EXTRUDERS 1 #define EXTRUDERS 1
#endif #endif
// Same again but for Y Axis. // Same again but for Y Axis.
...@@ -167,12 +167,12 @@ ...@@ -167,12 +167,12 @@
#define INVERT_Y2_VS_Y_DIR true #define INVERT_Y2_VS_Y_DIR true
#ifdef Y_DUAL_STEPPER_DRIVERS #ifdef Y_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS #undef EXTRUDERS
#define EXTRUDERS 1 #define EXTRUDERS 1
#endif #endif
#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS) #if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
#error "You cannot have dual drivers for both Y and Z" #error "You cannot have dual drivers for both Y and Z"
#endif #endif
// Enable this for dual x-carriage printers. // Enable this for dual x-carriage printers.
...@@ -188,10 +188,10 @@ ...@@ -188,10 +188,10 @@
#define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
// However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command). // without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer. // Remember: you should set the second extruder x-offset to 0 in your slicer.
// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
#define X2_ENABLE_PIN 29 #define X2_ENABLE_PIN 29
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
//Comment to disable setting feedrate multiplier via encoder //Comment to disable setting feedrate multiplier via encoder
#ifdef ULTIPANEL #ifdef ULTIPANEL
#define ULTIPANEL_FEEDMULTIPLY #define ULTIPANEL_FEEDMULTIPLY
#endif #endif
// minimum time in microseconds that a movement needs to take if the buffer is emptied. // minimum time in microseconds that a movement needs to take if the buffer is emptied.
...@@ -294,9 +294,9 @@ ...@@ -294,9 +294,9 @@
// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro // uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
//#define DIGIPOT_I2C //#define DIGIPOT_I2C
// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8 // Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
//#define DIGIPOT_I2C_NUM_CHANNELS 8 #define DIGIPOT_I2C_NUM_CHANNELS 8
// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS // actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
//#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
//=========================================================================== //===========================================================================
//=============================Additional Features=========================== //=============================Additional Features===========================
...@@ -305,21 +305,15 @@ ...@@ -305,21 +305,15 @@
//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
#ifdef SDSUPPORT #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
// Disable steppers when the file is done printing? #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
#define SD_FINISHED_STEPPERRELEASE true
// Command to send. You may want to keep Z enabled so your bed stays in place.
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E"
// Reverse file order of sd card menu display. It's sorted practically after the file system block order. //#define SDCARD_SORT_ALPHA // Sort SD file listings in ASCII order. Find additional options in cardreader.h
// When a file is deleted it frees a block, so the order is not purely chronological. #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order.
#define SDCARD_RATHERRECENTFIRST // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
// using:
// To still have auto0.g accessible, there is again the option to do that. Using:
//#define MENU_ADDAUTOSTART //#define MENU_ADDAUTOSTART
#endif // SDSUPPORT
// The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation. // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
//#define USE_WATCHDOG //#define USE_WATCHDOG
...@@ -338,19 +332,19 @@ ...@@ -338,19 +332,19 @@
// does not respect endstops! // does not respect endstops!
//#define BABYSTEPPING //#define BABYSTEPPING
#ifdef BABYSTEPPING #ifdef BABYSTEPPING
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z #define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
#ifdef COREXY #ifdef COREXY
#error BABYSTEPPING not implemented for COREXY yet. #error BABYSTEPPING not implemented for COREXY yet.
#endif #endif
#ifdef DELTA #ifdef DELTA
#ifdef BABYSTEP_XY #ifdef BABYSTEP_XY
#error BABYSTEPPING only implemented for Z axis on deltabots. #error BABYSTEPPING only implemented for Z axis on deltabots.
#endif #endif
#endif #endif
#endif #endif
// extruder advance constant (s2/mm3) // extruder advance constant (s2/mm3)
...@@ -363,12 +357,12 @@ ...@@ -363,12 +357,12 @@
//#define ADVANCE //#define ADVANCE
#ifdef ADVANCE #ifdef ADVANCE
#define EXTRUDER_ADVANCE_K .0 #define EXTRUDER_ADVANCE_K .0
#define D_FILAMENT 2.85 #define D_FILAMENT 2.85
#define STEPS_MM_E 836 #define STEPS_MM_E 836
#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
#endif // ADVANCE #endif // ADVANCE
...@@ -385,7 +379,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st ...@@ -385,7 +379,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#define SDCARDDETECTINVERTED #define SDCARDDETECTINVERTED
#ifdef ULTIPANEL #ifdef ULTIPANEL
#undef SDCARDDETECTINVERTED #undef SDCARDDETECTINVERTED
#endif #endif
// Power Signal Control Definitions // Power Signal Control Definitions
...@@ -400,8 +394,8 @@ const unsigned int dropsegments=5; //everything with less than this number of st ...@@ -400,8 +394,8 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#endif #endif
// 2 = X-Box 360 203W // 2 = X-Box 360 203W
#if (POWER_SUPPLY == 2) #if (POWER_SUPPLY == 2)
#define PS_ON_AWAKE HIGH #define PS_ON_AWAKE HIGH
#define PS_ON_ASLEEP LOW #define PS_ON_ASLEEP LOW
#endif #endif
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.
...@@ -414,9 +408,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st ...@@ -414,9 +408,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
// The number of linear motions that can be in the plan at any give time. // The number of linear motions that can be in the plan at any give time.
// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. // THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering.
#if defined SDSUPPORT #if defined SDSUPPORT
#define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller
#else #else
#define BLOCK_BUFFER_SIZE 16 // maximize block buffer #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
#endif #endif
...@@ -433,102 +427,102 @@ const unsigned int dropsegments=5; //everything with less than this number of st ...@@ -433,102 +427,102 @@ const unsigned int dropsegments=5; //everything with less than this number of st
// #define FWRETRACT //ONLY PARTIALLY TESTED // #define FWRETRACT //ONLY PARTIALLY TESTED
#ifdef FWRETRACT #ifdef FWRETRACT
#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
#define RETRACT_LENGTH 3 //default retract length (positive mm) #define RETRACT_LENGTH 3 //default retract length (positive mm)
#define RETRACT_LENGTH_SWAP 13 //default swap retract length (positive mm), for extruder change #define RETRACT_LENGTH_SWAP 13 //default swap retract length (positive mm), for extruder change
#define RETRACT_FEEDRATE 45 //default feedrate for retracting (mm/s) #define RETRACT_FEEDRATE 45 //default feedrate for retracting (mm/s)
#define RETRACT_ZLIFT 0 //default retract Z-lift #define RETRACT_ZLIFT 0 //default retract Z-lift
#define RETRACT_RECOVER_LENGTH 0 //default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH 0 //default additional recover length (mm, added to retract length when recovering)
#define RETRACT_RECOVER_LENGTH_SWAP 0 //default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_LENGTH_SWAP 0 //default additional swap recover length (mm, added to retract length when recovering from extruder change)
#define RETRACT_RECOVER_FEEDRATE 8 //default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE 8 //default feedrate for recovering from retraction (mm/s)
#endif #endif
//adds support for experimental filament exchange support M600; requires display //adds support for experimental filament exchange support M600; requires display
#ifdef ULTIPANEL #ifdef ULTIPANEL
//#define FILAMENTCHANGEENABLE #define FILAMENTCHANGEENABLE
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
#define FILAMENTCHANGE_XPOS 3 #define FILAMENTCHANGE_XPOS 3
#define FILAMENTCHANGE_YPOS 3 #define FILAMENTCHANGE_YPOS 3
#define FILAMENTCHANGE_ZADD 10 #define FILAMENTCHANGE_ZADD 10
#define FILAMENTCHANGE_FIRSTRETRACT -2 #define FILAMENTCHANGE_FIRSTRETRACT -2
#define FILAMENTCHANGE_FINALRETRACT -100 #define FILAMENTCHANGE_FINALRETRACT -100
#endif #endif
#endif #endif
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
#ifdef EXTRUDER_RUNOUT_PREVENT #ifdef EXTRUDER_RUNOUT_PREVENT
#error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
#endif #endif
#endif #endif
//=========================================================================== //===========================================================================
//============================= Define Defines ============================ //============================= Define Defines ============================
//=========================================================================== //===========================================================================
#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT #if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
#error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1" #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
#endif #endif
#if EXTRUDERS > 1 && defined HEATERS_PARALLEL #if EXTRUDERS > 1 && defined HEATERS_PARALLEL
#error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1" #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
#endif #endif
#if TEMP_SENSOR_0 > 0 #if TEMP_SENSOR_0 > 0
#define THERMISTORHEATER_0 TEMP_SENSOR_0 #define THERMISTORHEATER_0 TEMP_SENSOR_0
#define HEATER_0_USES_THERMISTOR #define HEATER_0_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_1 > 0 #if TEMP_SENSOR_1 > 0
#define THERMISTORHEATER_1 TEMP_SENSOR_1 #define THERMISTORHEATER_1 TEMP_SENSOR_1
#define HEATER_1_USES_THERMISTOR #define HEATER_1_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_2 > 0 #if TEMP_SENSOR_2 > 0
#define THERMISTORHEATER_2 TEMP_SENSOR_2 #define THERMISTORHEATER_2 TEMP_SENSOR_2
#define HEATER_2_USES_THERMISTOR #define HEATER_2_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_3 > 0 #if TEMP_SENSOR_3 > 0
#define THERMISTORHEATER_3 TEMP_SENSOR_3 #define THERMISTORHEATER_3 TEMP_SENSOR_3
#define HEATER_3_USES_THERMISTOR #define HEATER_3_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_BED > 0 #if TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED #define THERMISTORBED TEMP_SENSOR_BED
#define BED_USES_THERMISTOR #define BED_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_0 == -1 #if TEMP_SENSOR_0 == -1
#define HEATER_0_USES_AD595 #define HEATER_0_USES_AD595
#endif #endif
#if TEMP_SENSOR_1 == -1 #if TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595 #define HEATER_1_USES_AD595
#endif #endif
#if TEMP_SENSOR_2 == -1 #if TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595 #define HEATER_2_USES_AD595
#endif #endif
#if TEMP_SENSOR_3 == -1 #if TEMP_SENSOR_3 == -1
#define HEATER_3_USES_AD595 #define HEATER_3_USES_AD595
#endif #endif
#if TEMP_SENSOR_BED == -1 #if TEMP_SENSOR_BED == -1
#define BED_USES_AD595 #define BED_USES_AD595
#endif #endif
#if TEMP_SENSOR_0 == -2 #if TEMP_SENSOR_0 == -2
#define HEATER_0_USES_MAX6675 #define HEATER_0_USES_MAX6675
#endif #endif
#if TEMP_SENSOR_0 == 0 #if TEMP_SENSOR_0 == 0
#undef HEATER_0_MINTEMP #undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP #undef HEATER_0_MAXTEMP
#endif #endif
#if TEMP_SENSOR_1 == 0 #if TEMP_SENSOR_1 == 0
#undef HEATER_1_MINTEMP #undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP #undef HEATER_1_MAXTEMP
#endif #endif
#if TEMP_SENSOR_2 == 0 #if TEMP_SENSOR_2 == 0
#undef HEATER_2_MINTEMP #undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP #undef HEATER_2_MAXTEMP
#endif #endif
#if TEMP_SENSOR_3 == 0 #if TEMP_SENSOR_3 == 0
#undef HEATER_3_MINTEMP #undef HEATER_3_MINTEMP
#undef HEATER_3_MAXTEMP #undef HEATER_3_MAXTEMP
#endif #endif
#if TEMP_SENSOR_BED == 0 #if TEMP_SENSOR_BED == 0
#undef BED_MINTEMP #undef BED_MINTEMP
#undef BED_MAXTEMP #undef BED_MAXTEMP
#endif #endif
......
...@@ -111,10 +111,12 @@ uint8_t const SOFT_SPI_SCK_PIN = 13; ...@@ -111,10 +111,12 @@ uint8_t const SOFT_SPI_SCK_PIN = 13;
/** /**
* Defines for long (vfat) filenames * Defines for long (vfat) filenames
*/ */
/** Number of UTF-16 characters per entry */
#define FILENAME_LENGTH 13
/** Number of VFAT entries used. Every entry has 13 UTF-16 characters */ /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
#define MAX_VFAT_ENTRIES (2) #define MAX_VFAT_ENTRIES (2)
/** Total size of the buffer used to store the long filenames */ /** Total size of the buffer used to store the long filenames */
#define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1) #define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
#endif // SdFatConfig_h #endif // SdFatConfig_h
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
CardReader::CardReader() CardReader::CardReader()
{ {
#ifdef SDCARD_SORT_ALPHA
sort_count = 0;
#endif
filesize = 0; filesize = 0;
sdpos = 0; sdpos = 0;
sdprinting = false; sdprinting = false;
...@@ -33,19 +36,15 @@ CardReader::CardReader() ...@@ -33,19 +36,15 @@ CardReader::CardReader()
autostart_atmillis=millis()+5000; autostart_atmillis=millis()+5000;
} }
char *createFilename(char *buffer,const dir_t &p) //buffer>12characters char *createFilename(char *buffer, const dir_t &p) //buffer>12characters
{ {
char *pos=buffer; char *pos=buffer;
for (uint8_t i = 0; i < 11; i++) for (uint8_t i = 0; i < 11; i++) {
{ if (p.name[i] == ' ') continue;
if (p.name[i] == ' ')continue; if (i == 8) *pos++ = '.';
if (i == 8) *pos++ = p.name[i];
{
*pos++='.';
} }
*pos++=p.name[i]; *pos++ = 0;
}
*pos++=0;
return buffer; return buffer;
} }
...@@ -60,8 +59,8 @@ void CardReader::lsDive(const char *prepend,SdFile parent) ...@@ -60,8 +59,8 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
{ {
char path[13*2]; char path[FILENAME_LENGTH*2];
char lfilename[13]; char lfilename[FILENAME_LENGTH];
createFilename(lfilename,p); createFilename(lfilename,p);
path[0]=0; path[0]=0;
...@@ -87,8 +86,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent) ...@@ -87,8 +86,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
} }
lsDive(path,dir); lsDive(path,dir);
//close done automatically by destructor of SdFile //close done automatically by destructor of SdFile
} }
else else
{ {
...@@ -105,7 +102,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent) ...@@ -105,7 +102,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue; if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
filenameIsDir=DIR_IS_SUBDIR(&p); filenameIsDir=DIR_IS_SUBDIR(&p);
if(!filenameIsDir) if(!filenameIsDir)
{ {
if(p.name[8]!='G') continue; if(p.name[8]!='G') continue;
...@@ -124,10 +120,8 @@ void CardReader::lsDive(const char *prepend,SdFile parent) ...@@ -124,10 +120,8 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
} }
else if(lsAction==LS_GetFilename) else if(lsAction==LS_GetFilename)
{ {
if(cnt==nrFiles) if (cnt == nrFiles) return;
return;
cnt++; cnt++;
} }
} }
} }
...@@ -136,9 +130,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent) ...@@ -136,9 +130,6 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
void CardReader::ls() void CardReader::ls()
{ {
lsAction=LS_SerialPrint; lsAction=LS_SerialPrint;
if(lsAction==LS_Count)
nrFiles=0;
root.rewind(); root.rewind();
lsDive("",root); lsDive("",root);
} }
...@@ -177,6 +168,9 @@ void CardReader::initsd() ...@@ -177,6 +168,9 @@ void CardReader::initsd()
} }
workDir=root; workDir=root;
curDir=&root; curDir=&root;
#ifdef SDCARD_SORT_ALPHA
presort();
#endif
/* /*
if(!workDir.openRoot(&volume)) if(!workDir.openRoot(&volume))
{ {
...@@ -193,8 +187,10 @@ void CardReader::setroot() ...@@ -193,8 +187,10 @@ void CardReader::setroot()
SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL); SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL);
}*/ }*/
workDir=root; workDir=root;
curDir=&workDir; curDir=&workDir;
#ifdef SDCARD_SORT_ALPHA
presort();
#endif
} }
void CardReader::release() void CardReader::release()
{ {
...@@ -207,6 +203,9 @@ void CardReader::startFileprint() ...@@ -207,6 +203,9 @@ void CardReader::startFileprint()
if(cardOK) if(cardOK)
{ {
sdprinting = true; sdprinting = true;
#ifdef SDCARD_SORT_ALPHA
flush_presort();
#endif
} }
} }
...@@ -235,7 +234,7 @@ void CardReader::getAbsFilename(char *t) ...@@ -235,7 +234,7 @@ void CardReader::getAbsFilename(char *t)
while(*t!=0 && cnt< MAXPATHNAMELENGTH) while(*t!=0 && cnt< MAXPATHNAMELENGTH)
{t++;cnt++;} //crawl counter forward. {t++;cnt++;} //crawl counter forward.
} }
if(cnt<MAXPATHNAMELENGTH-13) if(cnt<MAXPATHNAMELENGTH-FILENAME_LENGTH)
file.getFilename(t); file.getFilename(t);
else else
t[0]=0; t[0]=0;
...@@ -305,7 +304,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/) ...@@ -305,7 +304,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if(dirname_end>0 && dirname_end>dirname_start) if(dirname_end>0 && dirname_end>dirname_start)
{ {
char subdirname[13]; char subdirname[FILENAME_LENGTH];
strncpy(subdirname, dirname_start, dirname_end-dirname_start); strncpy(subdirname, dirname_start, dirname_end-dirname_start);
subdirname[dirname_end-dirname_start]=0; subdirname[dirname_end-dirname_start]=0;
SERIAL_ECHOLN(subdirname); SERIAL_ECHOLN(subdirname);
...@@ -401,7 +400,7 @@ void CardReader::removeFile(char* name) ...@@ -401,7 +400,7 @@ void CardReader::removeFile(char* name)
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if(dirname_end>0 && dirname_end>dirname_start) if(dirname_end>0 && dirname_end>dirname_start)
{ {
char subdirname[13]; char subdirname[FILENAME_LENGTH];
strncpy(subdirname, dirname_start, dirname_end-dirname_start); strncpy(subdirname, dirname_start, dirname_end-dirname_start);
subdirname[dirname_end-dirname_start]=0; subdirname[dirname_end-dirname_start]=0;
SERIAL_ECHOLN(subdirname); SERIAL_ECHOLN(subdirname);
...@@ -439,6 +438,9 @@ void CardReader::removeFile(char* name) ...@@ -439,6 +438,9 @@ void CardReader::removeFile(char* name)
SERIAL_PROTOCOLPGM("File deleted:"); SERIAL_PROTOCOLPGM("File deleted:");
SERIAL_PROTOCOLLN(fname); SERIAL_PROTOCOLLN(fname);
sdpos = 0; sdpos = 0;
#ifdef SDCARD_SORT_ALPHA
presort();
#endif
} }
else else
{ {
...@@ -552,14 +554,21 @@ void CardReader::closefile(bool store_location) ...@@ -552,14 +554,21 @@ void CardReader::closefile(bool store_location)
} }
void CardReader::getfilename(const uint8_t nr) void CardReader::getfilename(const uint16_t nr)
{ {
#if defined(SDCARD_SORT_ALPHA) && SORT_USES_RAM && SORT_USES_MORE_RAM
if (nr < sort_count) {
strcpy(filename, sortshort[nr]);
strcpy(longFilename, sortnames[nr]);
filenameIsDir = isDir[nr];
return;
}
#endif
curDir=&workDir; curDir=&workDir;
lsAction=LS_GetFilename; lsAction=LS_GetFilename;
nrFiles=nr; nrFiles=nr;
curDir->rewind(); curDir->rewind();
lsDive("",*curDir); lsDive("",*curDir);
} }
uint16_t CardReader::getnrfilenames() uint16_t CardReader::getnrfilenames()
...@@ -595,21 +604,164 @@ void CardReader::chdir(const char * relpath) ...@@ -595,21 +604,164 @@ void CardReader::chdir(const char * relpath)
workDirParents[0]=*parent; workDirParents[0]=*parent;
} }
workDir=newfile; workDir=newfile;
#ifdef SDCARD_SORT_ALPHA
presort();
#endif
} }
} }
void CardReader::updir() void CardReader::updir()
{ {
if(workDirDepth > 0) if (workDirDepth > 0)
{ {
--workDirDepth; --workDirDepth;
workDir = workDirParents[0]; workDir = workDirParents[0];
int d;
for (int d = 0; d < workDirDepth; d++) for (int d = 0; d < workDirDepth; d++)
workDirParents[d] = workDirParents[d+1]; workDirParents[d] = workDirParents[d+1];
#ifdef SDCARD_SORT_ALPHA
presort();
#endif
}
}
#ifdef SDCARD_SORT_ALPHA
/**
* Get the name of a file in the current directory by sort-index
*/
void CardReader::getfilename_sorted(const uint16_t nr) {
getfilename(nr < sort_count ? sort_order[nr] : nr);
}
/**
* Read all the files and produce a sort key
*
* We can do this in 3 ways...
* - Minimal RAM: Read two filenames at a time sorting along...
* - Some RAM: Buffer the directory and return filenames from RAM
* - Some RAM: Buffer the directory just for this sort
*/
void CardReader::presort()
{
flush_presort();
uint16_t fileCnt = getnrfilenames();
if (fileCnt > 0) {
if (fileCnt > SORT_LIMIT) fileCnt = SORT_LIMIT;
#if SORT_USES_RAM
#if SORT_USES_MORE_RAM
sortshort = (char**)calloc(fileCnt, sizeof(char*));
sortnames = (char**)calloc(fileCnt, sizeof(char*));
#else
char *sortnames[fileCnt];
#endif
#else
char name1[LONG_FILENAME_LENGTH+1];
#endif
#if FOLDER_SORTING != 0
#if SORT_USES_RAM && SORT_USES_MORE_RAM
isDir = (uint8_t*)calloc(fileCnt, sizeof(uint8_t));
#else
uint8_t isDir[fileCnt];
#endif
#endif
sort_order = new uint8_t[fileCnt];
if (fileCnt > 1) {
// Init sort order. If using RAM then read all filenames now.
for (uint16_t i=0; i<fileCnt; i++) {
sort_order[i] = i;
#if SORT_USES_RAM
getfilename(i);
sortnames[i] = strdup(longFilename[0] ? longFilename : filename);
#if SORT_USES_MORE_RAM
sortshort[i] = strdup(filename);
#endif
// char out[30];
// sprintf_P(out, PSTR("---- %i %s %s"), i, filenameIsDir ? "D" : " ", sortnames[i]);
// SERIAL_ECHOLN(out);
#if FOLDER_SORTING != 0
isDir[i] = filenameIsDir;
#endif
#endif
}
// Bubble Sort
for (uint16_t i=fileCnt; --i;) {
bool cmp, didSwap = false;
for (uint16_t j=0; j<i; ++j) {
uint16_t s1 = j, s2 = j+1, o1 = sort_order[s1], o2 = sort_order[s2];
#if SORT_USES_RAM
#if FOLDER_SORTING != 0
cmp = (isDir[o1] == isDir[o2]) ? (strcasecmp(sortnames[o1], sortnames[o2]) > 0) : isDir[FOLDER_SORTING > 0 ? o1 : o2];
#else
cmp = strcasecmp(sortnames[o1], sortnames[o2]) > 0;
#endif
#else
getfilename(o1);
strcpy(name1, longFilename[0] ? longFilename : filename);
#if FOLDER_SORTING != 0
bool dir1 = filenameIsDir;
#endif
getfilename(o2);
char *name2 = longFilename[0] ? longFilename : filename;
#if FOLDER_SORTING != 0
cmp = (dir1 == filenameIsDir) ? (strcasecmp(name1, name2) > 0) : (FOLDER_SORTING > 0 ? dir1 : !dir1);
#else
cmp = strcasecmp(name1, name2) > 0;
#endif
#endif
if (cmp) {
sort_order[s1] = o2;
sort_order[s2] = o1;
didSwap = true;
}
}
if (!didSwap) break;
}
#if SORT_USES_RAM && !SORT_USES_MORE_RAM
for (uint16_t i=0; i<fileCnt; ++i) free(sortnames[i]);
#endif
}
else {
sort_order[0] = 0;
#if SORT_USES_RAM && SORT_USES_MORE_RAM
sortnames = (char**)malloc(sizeof(char*));
sortshort = (char**)malloc(sizeof(char*));
isDir = (uint8_t*)malloc(sizeof(uint8_t));
getfilename(0);
sortnames[0] = strdup(longFilename[0] ? longFilename : filename);
sortshort[0] = strdup(filename);
isDir[0] = filenameIsDir;
#endif
}
sort_count = fileCnt;
}
}
void CardReader::flush_presort() {
if (sort_count > 0) {
#if SORT_USES_RAM && SORT_USES_MORE_RAM
for (uint8_t i=0; i<sort_count; ++i) {
free(sortshort[i]);
free(sortnames[i]);
}
free(sortshort);
free(sortnames);
#endif
delete sort_order;
sort_count = 0;
} }
} }
#endif // SDCARD_SORT_ALPHA
void CardReader::printingHasFinished() void CardReader::printingHasFinished()
{ {
...@@ -633,6 +785,9 @@ void CardReader::printingHasFinished() ...@@ -633,6 +785,9 @@ void CardReader::printingHasFinished()
enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND)); enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
} }
autotempShutdown(); autotempShutdown();
#ifdef SDCARD_SORT_ALPHA
presort();
#endif
} }
} }
#endif //SDSUPPORT #endif //SDSUPPORT
...@@ -3,7 +3,14 @@ ...@@ -3,7 +3,14 @@
#ifdef SDSUPPORT #ifdef SDSUPPORT
#define MAX_DIR_DEPTH 10 #define MAX_DIR_DEPTH 10 // Maximum folder depth
#ifdef SDCARD_SORT_ALPHA
#define SORT_USES_RAM false // Buffer while sorting, else re-read from SD
#define SORT_USES_MORE_RAM false // Always keep the directory in RAM
#define SORT_LIMIT 256 // Maximum number of sorted items
#define FOLDER_SORTING -1 // -1=above 0=none 1=below
#endif
#include "SdFile.h" #include "SdFile.h"
enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename}; enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename};
...@@ -28,7 +35,7 @@ public: ...@@ -28,7 +35,7 @@ public:
void getStatus(); void getStatus();
void printingHasFinished(); void printingHasFinished();
void getfilename(const uint8_t nr); void getfilename(const uint16_t nr);
uint16_t getnrfilenames(); uint16_t getnrfilenames();
void getAbsFilename(char *t); void getAbsFilename(char *t);
...@@ -39,6 +46,12 @@ public: ...@@ -39,6 +46,12 @@ public:
void updir(); void updir();
void setroot(); void setroot();
#ifdef SDCARD_SORT_ALPHA
void presort();
void flush_presort();
void getfilename_sorted(const uint16_t nr);
#endif
FORCE_INLINE bool isFileOpen() { return file.isOpen(); } FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
FORCE_INLINE bool eof() { return sdpos>=filesize ;}; FORCE_INLINE bool eof() { return sdpos>=filesize ;};
...@@ -50,20 +63,29 @@ public: ...@@ -50,20 +63,29 @@ public:
public: public:
bool saving; bool saving;
bool logging; bool logging;
bool sdprinting ; bool sdprinting;
bool cardOK ; bool cardOK;
char filename[13]; char filename[FILENAME_LENGTH];
char longFilename[LONG_FILENAME_LENGTH]; char longFilename[LONG_FILENAME_LENGTH];
bool filenameIsDir; bool filenameIsDir;
int lastnr; //last number of the autostart; int lastnr; //last number of the autostart;
private: private:
SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH]; SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
uint16_t workDirDepth; uint16_t workDirDepth;
#ifdef SDCARD_SORT_ALPHA
uint16_t sort_count;
uint8_t *sort_order;
#if SORT_USES_MORE_RAM
char **sortshort;
char **sortnames;
uint8_t *isDir;
#endif
#endif
Sd2Card card; Sd2Card card;
SdVolume volume; SdVolume volume;
SdFile file; SdFile file;
#define SD_PROCEDURE_DEPTH 1 #define SD_PROCEDURE_DEPTH 1
#define MAXPATHNAMELENGTH (13*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1) #define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1)
uint8_t file_subcall_ctr; uint8_t file_subcall_ctr;
uint32_t filespos[SD_PROCEDURE_DEPTH]; uint32_t filespos[SD_PROCEDURE_DEPTH];
char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
...@@ -75,7 +97,7 @@ private: ...@@ -75,7 +97,7 @@ private:
bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware. bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
LsAction lsAction; //stored for recursion. LsAction lsAction; //stored for recursion.
int16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
char* diveDirName; char* diveDirName;
void lsDive(const char *prepend,SdFile parent); void lsDive(const char *prepend,SdFile parent);
}; };
......
...@@ -1207,9 +1207,9 @@ void lcd_sdcard_menu() ...@@ -1207,9 +1207,9 @@ void lcd_sdcard_menu()
card.getWorkDirName(); card.getWorkDirName();
if(card.filename[0]=='/') if(card.filename[0]=='/')
{ {
#if SDCARDDETECT == -1 #if SDCARDDETECT == -1
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh); MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
#endif #endif
}else{ }else{
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
} }
...@@ -1218,15 +1218,22 @@ void lcd_sdcard_menu() ...@@ -1218,15 +1218,22 @@ void lcd_sdcard_menu()
{ {
if (_menuItemNr == _lineNr) if (_menuItemNr == _lineNr)
{ {
#ifndef SDCARD_RATHERRECENTFIRST #if defined(SDCARD_RATHERRECENTFIRST) && !defined(SDCARD_SORT_ALPHA)
card.getfilename(i); int nr = fileCnt-1-i;
#else #else
card.getfilename(fileCnt-1-i); int nr = i;
#endif #endif
if (card.filenameIsDir)
{ #ifdef SDCARD_SORT_ALPHA
card.getfilename_sorted(nr);
#else
card.getfilename(nr);
#endif
if (card.filenameIsDir) {
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename); MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
}else{ }
else {
MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename); MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
} }
}else{ }else{
...@@ -1433,7 +1440,7 @@ void lcd_init() ...@@ -1433,7 +1440,7 @@ void lcd_init()
#endif // SR_LCD_2W_NL #endif // SR_LCD_2W_NL
#endif//!NEWPANEL #endif//!NEWPANEL
#if defined (SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) #if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
pinMode(SDCARDDETECT,INPUT); pinMode(SDCARDDETECT,INPUT);
WRITE(SDCARDDETECT, HIGH); WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED; lcd_oldcardstatus = IS_SD_INSERTED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment