Fix for #197 Print Menu file list, when there were exactely 3 files or folders on the sd card. This was caused by a misinterpreted comparision between uint16_t and integer.
This commit is contained in:
@@ -1312,18 +1312,13 @@
|
|||||||
#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
|
#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
|
||||||
//#define Z_AFTER_PROBING 5 // Z position after probing is done
|
//#define Z_AFTER_PROBING 5 // Z position after probing is done
|
||||||
|
|
||||||
#if ENABLED(KNUTWURST_BLTOUCH)
|
|
||||||
#define Z_PROBE_LOW_POINT -10 // Farthest distance below the trigger-point to go before stopping
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DISABLED(KNUTWURST_BLTOUCH)
|
#define Z_PROBE_LOW_POINT -12 // Farthest distance below the trigger-point to go before stopping
|
||||||
#define Z_PROBE_LOW_POINT -12 // Farthest distance below the trigger-point to go before stopping
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// For M851 give a range for adjusting the Z probe offset
|
// For M851 give a range for adjusting the Z probe offset
|
||||||
#define Z_PROBE_OFFSET_RANGE_MIN -20
|
#define Z_PROBE_OFFSET_RANGE_MIN -30
|
||||||
#define Z_PROBE_OFFSET_RANGE_MAX 20
|
#define Z_PROBE_OFFSET_RANGE_MAX 30
|
||||||
|
|
||||||
// Enable the M48 repeatability test to test probe accuracy
|
// Enable the M48 repeatability test to test probe accuracy
|
||||||
#if ENABLED(KNUTWURST_BLTOUCH)
|
#if ENABLED(KNUTWURST_BLTOUCH)
|
||||||
|
@@ -1134,24 +1134,33 @@ void AnycubicTouchscreenClass::PrintList()
|
|||||||
if (card.isMounted())
|
if (card.isMounted())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
uint16_t count = filenumber;
|
int count = filenumber;
|
||||||
uint16_t max_files;
|
int max_files;
|
||||||
uint16_t MyFileNrCnt = card.countFilesInWorkDir();
|
int filesOnSDCard = card.countFilesInWorkDir();
|
||||||
|
|
||||||
// What is this shit? What if there are exactely 3 files+folders?
|
// What is this shit? What if there are exactely 3 files+folders?
|
||||||
// TODO: find something better than this crap.
|
// TODO: find something better than this crap.
|
||||||
if ((MyFileNrCnt - filenumber) < 4)
|
|
||||||
|
if ((filesOnSDCard - filenumber) < 4)
|
||||||
{
|
{
|
||||||
max_files = MyFileNrCnt;
|
max_files = filesOnSDCard;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOLN("max_files = filesOnSDCard;");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
max_files = filenumber + 3;
|
max_files = filenumber + 3;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOLN("max_files = filenumber + 3;");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = filenumber; count <= max_files; count++)
|
//max_files = filesOnSDCard;
|
||||||
{
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPGM("filesOnSDCard: ");
|
||||||
|
SERIAL_ECHOLN(filesOnSDCard);
|
||||||
SERIAL_ECHOPGM("filenumber: ");
|
SERIAL_ECHOPGM("filenumber: ");
|
||||||
SERIAL_ECHOLN(filenumber);
|
SERIAL_ECHOLN(filenumber);
|
||||||
SERIAL_ECHOPGM("max_files: ");
|
SERIAL_ECHOPGM("max_files: ");
|
||||||
@@ -1160,6 +1169,8 @@ void AnycubicTouchscreenClass::PrintList()
|
|||||||
SERIAL_ECHOLN(count);
|
SERIAL_ECHOLN(count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (count = filenumber; count <= max_files; count++)
|
||||||
|
{
|
||||||
if (count == 0) // Special Entry
|
if (count == 0) // Special Entry
|
||||||
{
|
{
|
||||||
if (strcmp(card.getWorkDirName(), "/") == 0)
|
if (strcmp(card.getWorkDirName(), "/") == 0)
|
||||||
@@ -1215,23 +1226,23 @@ void AnycubicTouchscreenClass::PrintList()
|
|||||||
if (card.flag.filenameIsDir)
|
if (card.flag.filenameIsDir)
|
||||||
{
|
{
|
||||||
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||||
HARDWARE_SERIAL_PROTOCOLPGM("/");
|
HARDWARE_SERIAL_PROTOCOLPGM("/");
|
||||||
HARDWARE_SERIAL_PROTOCOL(card.filename);
|
HARDWARE_SERIAL_PROTOCOL(card.filename);
|
||||||
HARDWARE_SERIAL_PROTOCOLLNPGM(".GCO");
|
HARDWARE_SERIAL_PROTOCOLLNPGM(".GCO");
|
||||||
HARDWARE_SERIAL_PROTOCOLPGM("/");
|
HARDWARE_SERIAL_PROTOCOLPGM("/");
|
||||||
HARDWARE_SERIAL_PROTOCOL(outputString);
|
HARDWARE_SERIAL_PROTOCOL(outputString);
|
||||||
HARDWARE_SERIAL_PROTOCOLLNPGM(".gcode");
|
HARDWARE_SERIAL_PROTOCOLLNPGM(".gcode");
|
||||||
SERIAL_ECHO(count);
|
SERIAL_ECHO(count);
|
||||||
SERIAL_ECHOPGM(": /");
|
SERIAL_ECHOPGM(": /");
|
||||||
SERIAL_ECHOLN(outputString);
|
SERIAL_ECHOLN(outputString);
|
||||||
#else
|
#else
|
||||||
HARDWARE_SERIAL_PROTOCOL("/");
|
HARDWARE_SERIAL_PROTOCOL("/");
|
||||||
HARDWARE_SERIAL_PROTOCOLLN(card.filename);
|
HARDWARE_SERIAL_PROTOCOLLN(card.filename);
|
||||||
HARDWARE_SERIAL_PROTOCOL("/");
|
HARDWARE_SERIAL_PROTOCOL("/");
|
||||||
HARDWARE_SERIAL_PROTOCOLLN(outputString);
|
HARDWARE_SERIAL_PROTOCOLLN(outputString);
|
||||||
SERIAL_ECHO(count);
|
SERIAL_ECHO(count);
|
||||||
SERIAL_ECHOPGM(": /");
|
SERIAL_ECHOPGM(": /");
|
||||||
SERIAL_ECHOLN(outputString);
|
SERIAL_ECHOLN(outputString);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -281,7 +281,7 @@ private:
|
|||||||
int serial3_count = 0;
|
int serial3_count = 0;
|
||||||
char *TFTstrchr_pointer;
|
char *TFTstrchr_pointer;
|
||||||
char FlagResumFromOutage = 0;
|
char FlagResumFromOutage = 0;
|
||||||
uint16_t filenumber = 0;
|
int filenumber = 0;
|
||||||
unsigned long starttime = 0;
|
unsigned long starttime = 0;
|
||||||
unsigned long stoptime = 0;
|
unsigned long stoptime = 0;
|
||||||
uint8_t tmp_extruder = 0;
|
uint8_t tmp_extruder = 0;
|
||||||
|
Reference in New Issue
Block a user