Version 0.78k
Fixed combined xyz move bug (thanks zpl). Reversed default direction of X motor. Added support for M569 command. Fixed bug in execution of M503 command via web interface.
This commit is contained in:
parent
46d78148b0
commit
13f2ab5bfd
7 changed files with 55 additions and 42 deletions
|
@ -24,8 +24,8 @@ Licence: GPL
|
||||||
#define CONFIGURATION_H
|
#define CONFIGURATION_H
|
||||||
|
|
||||||
#define NAME "RepRapFirmware"
|
#define NAME "RepRapFirmware"
|
||||||
#define VERSION "0.78j-dc42"
|
#define VERSION "0.78k-dc42"
|
||||||
#define DATE "2014-08-17"
|
#define DATE "2014-08-18"
|
||||||
#define AUTHORS "reprappro, dc42, zpl"
|
#define AUTHORS "reprappro, dc42, zpl"
|
||||||
|
|
||||||
// Other firmware that we might switch to be compatible with.
|
// Other firmware that we might switch to be compatible with.
|
||||||
|
|
16
GCodes.cpp
16
GCodes.cpp
|
@ -1877,7 +1877,6 @@ bool GCodes::HandleMcode(GCodeBuffer* gb)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 21: // Initialise SD - ignore
|
case 21: // Initialise SD - ignore
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2849,6 +2848,21 @@ bool GCodes::HandleMcode(GCodeBuffer* gb)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 569: // Set/report axis direction
|
||||||
|
if(gb->Seen('P'))
|
||||||
|
{
|
||||||
|
int8_t drive = gb->GetIValue();
|
||||||
|
if(gb->Seen('S'))
|
||||||
|
{
|
||||||
|
platform->SetDirectionValue(drive, gb->GetIValue());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reply.printf("A %d sends drive %d forwards.", (int)platform->GetDirectionValue(drive), drive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 906: // Set/report Motor currents
|
case 906: // Set/report Motor currents
|
||||||
{
|
{
|
||||||
bool seen = false;
|
bool seen = false;
|
||||||
|
|
3
Move.cpp
3
Move.cpp
|
@ -1199,7 +1199,8 @@ void DDA::Step()
|
||||||
|
|
||||||
if(active)
|
if(active)
|
||||||
{
|
{
|
||||||
timeStep = move->stepDistances[drivesMoving]/velocity;
|
timeStep = distance/(totalSteps * velocity); // dc42 use the average distance per step
|
||||||
|
//timeStep = move->stepDistances[drivesMoving]/velocity;
|
||||||
|
|
||||||
// Simple Euler integration to get velocities.
|
// Simple Euler integration to get velocities.
|
||||||
// Maybe one day do a Runge-Kutta?
|
// Maybe one day do a Runge-Kutta?
|
||||||
|
|
52
Platform.cpp
52
Platform.cpp
|
@ -182,6 +182,7 @@ void Platform::Init()
|
||||||
|
|
||||||
stepPins = STEP_PINS;
|
stepPins = STEP_PINS;
|
||||||
directionPins = DIRECTION_PINS;
|
directionPins = DIRECTION_PINS;
|
||||||
|
directions = DIRECTIONS;
|
||||||
enablePins = ENABLE_PINS;
|
enablePins = ENABLE_PINS;
|
||||||
disableDrives = DISABLE_DRIVES;
|
disableDrives = DISABLE_DRIVES;
|
||||||
lowStopPins = LOW_STOP_PINS;
|
lowStopPins = LOW_STOP_PINS;
|
||||||
|
@ -986,13 +987,15 @@ void Platform::SetDirection(byte drive, bool direction)
|
||||||
{
|
{
|
||||||
if(directionPins[drive] < 0)
|
if(directionPins[drive] < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool d = (direction == FORWARDS) ? directions[drive] : !directions[drive];
|
||||||
if(drive == E0_DRIVE) //DIRECTION_PINS {15, 26, 4, X3, 35, 53, 51, 48}
|
if(drive == E0_DRIVE) //DIRECTION_PINS {15, 26, 4, X3, 35, 53, 51, 48}
|
||||||
{
|
{
|
||||||
digitalWriteNonDue(directionPins[drive], direction);
|
digitalWriteNonDue(directionPins[drive], d);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
digitalWrite(directionPins[drive], direction);
|
digitalWrite(directionPins[drive], d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1014,9 +1017,13 @@ void Platform::Step(byte drive)
|
||||||
if(!driveEnabled[drive] && enablePins[drive] >= 0)
|
if(!driveEnabled[drive] && enablePins[drive] >= 0)
|
||||||
{
|
{
|
||||||
if(drive == Z_AXIS || drive==E0_DRIVE || drive==E2_DRIVE) //ENABLE_PINS {29, 27, X1, X0, 37, X8, 50, 47}
|
if(drive == Z_AXIS || drive==E0_DRIVE || drive==E2_DRIVE) //ENABLE_PINS {29, 27, X1, X0, 37, X8, 50, 47}
|
||||||
|
{
|
||||||
digitalWriteNonDue(enablePins[drive], ENABLE);
|
digitalWriteNonDue(enablePins[drive], ENABLE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
digitalWrite(enablePins[drive], ENABLE);
|
digitalWrite(enablePins[drive], ENABLE);
|
||||||
|
}
|
||||||
driveEnabled[drive] = true;
|
driveEnabled[drive] = true;
|
||||||
}
|
}
|
||||||
if(drive == E0_DRIVE || drive == E3_DRIVE) //STEP_PINS {14, 25, 5, X2, 41, 39, X4, 49}
|
if(drive == E0_DRIVE || drive == E3_DRIVE) //STEP_PINS {14, 25, 5, X2, 41, 39, X4, 49}
|
||||||
|
@ -1469,7 +1476,7 @@ bool MassStorage::FindNext(FileInfo &file_info)
|
||||||
file_info.year = (entry.fdate >> 9) + 1980;
|
file_info.year = (entry.fdate >> 9) + 1980;
|
||||||
if (file_info.fileName[0] == 0)
|
if (file_info.fileName[0] == 0)
|
||||||
{
|
{
|
||||||
strncpy(file_info.fileName, entry.fname, ARRAY_UPB(file_info.fileName));
|
strncpy(file_info.fileName, entry.fname, ARRAY_SIZE(file_info.fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1571,44 +1578,21 @@ bool FileStore::Open(const char* directory, const char* fileName, bool write)
|
||||||
const char* location = (directory != NULL)
|
const char* location = (directory != NULL)
|
||||||
? platform->GetMassStorage()->CombineName(directory, fileName)
|
? platform->GetMassStorage()->CombineName(directory, fileName)
|
||||||
: fileName;
|
: fileName;
|
||||||
|
|
||||||
writing = write;
|
writing = write;
|
||||||
lastBufferEntry = FILE_BUF_LEN - 1;
|
lastBufferEntry = FILE_BUF_LEN - 1;
|
||||||
FRESULT openReturn;
|
FRESULT openReturn = f_open(&file, location, (writing) ? FA_CREATE_ALWAYS | FA_WRITE : FA_OPEN_EXISTING | FA_READ);
|
||||||
|
|
||||||
if (writing)
|
|
||||||
{
|
|
||||||
openReturn = f_open(&file, location, FA_CREATE_ALWAYS | FA_WRITE);
|
|
||||||
if (openReturn != FR_OK)
|
if (openReturn != FR_OK)
|
||||||
{
|
{
|
||||||
char errString[10]; // don't use scratch_string for this because that may be holding the original filename
|
char errString[12]; // don't use scratch_string for this because that may be holding the original filename
|
||||||
platform->Message(HOST_MESSAGE, "Can't open ");
|
platform->Message(BOTH_MESSAGE, "Can't open ");
|
||||||
platform->Message(HOST_MESSAGE, location);
|
platform->AppendMessage(BOTH_MESSAGE, location);
|
||||||
platform->Message(HOST_MESSAGE, " to write to, error code ");
|
platform->AppendMessage(BOTH_MESSAGE, (writing) ? " to write to, error code " : " to read from, error code ");
|
||||||
snprintf(errString, ARRAY_SIZE(errString), "%d", openReturn);
|
snprintf(errString, ARRAY_SIZE(errString), "%d\n", openReturn);
|
||||||
platform->Message(HOST_MESSAGE, errString);
|
platform->AppendMessage(BOTH_MESSAGE, errString);
|
||||||
platform->Message(HOST_MESSAGE, "\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bufferPointer = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
openReturn = f_open(&file, location, FA_OPEN_EXISTING | FA_READ);
|
|
||||||
if (openReturn != FR_OK)
|
|
||||||
{
|
|
||||||
char errString[10]; // don't use scratch_string for this because that may be holding the original filename
|
|
||||||
platform->Message(HOST_MESSAGE, "Can't open ");
|
|
||||||
platform->Message(HOST_MESSAGE, location);
|
|
||||||
platform->Message(HOST_MESSAGE, " to read from, error code ");
|
|
||||||
snprintf(errString, ARRAY_SIZE(errString), "%d", openReturn);
|
|
||||||
platform->Message(HOST_MESSAGE, errString);
|
|
||||||
platform->Message(HOST_MESSAGE, "\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bufferPointer = FILE_BUF_LEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bufferPointer = (writing) ? 0 : FILE_BUF_LEN;
|
||||||
inUse = true;
|
inUse = true;
|
||||||
openCount = 1;
|
openCount = 1;
|
||||||
return true;
|
return true;
|
||||||
|
|
16
Platform.h
16
Platform.h
|
@ -78,7 +78,8 @@ Licence: GPL
|
||||||
#define STEP_PINS {14, 25, 5, X2, 41, 39, X4, 49}
|
#define STEP_PINS {14, 25, 5, X2, 41, 39, X4, 49}
|
||||||
#define DIRECTION_PINS {15, 26, 4, X3, 35, 53, 51, 48}
|
#define DIRECTION_PINS {15, 26, 4, X3, 35, 53, 51, 48}
|
||||||
#define FORWARDS true // What to send to go...
|
#define FORWARDS true // What to send to go...
|
||||||
#define BACKWARDS false // ...in each direction
|
#define BACKWARDS (!FORWARDS) // ...in each direction
|
||||||
|
#define DIRECTIONS {false, true, true, true, true, true, true, true}
|
||||||
#define ENABLE_PINS {29, 27, X1, X0, 37, X8, 50, 47}
|
#define ENABLE_PINS {29, 27, X1, X0, 37, X8, 50, 47}
|
||||||
#define ENABLE false // What to send to enable...
|
#define ENABLE false // What to send to enable...
|
||||||
#define DISABLE true // ...and disable a drive
|
#define DISABLE true // ...and disable a drive
|
||||||
|
@ -592,6 +593,8 @@ public:
|
||||||
|
|
||||||
void EmergencyStop();
|
void EmergencyStop();
|
||||||
void SetDirection(byte drive, bool direction);
|
void SetDirection(byte drive, bool direction);
|
||||||
|
void SetDirectionValue(byte drive, bool dVal);
|
||||||
|
bool GetDirectionValue(byte drive) const;
|
||||||
void Step(byte drive);
|
void Step(byte drive);
|
||||||
void Disable(byte drive); // There is no drive enable; drives get enabled automatically the first time they are used.
|
void Disable(byte drive); // There is no drive enable; drives get enabled automatically the first time they are used.
|
||||||
void SetMotorCurrent(byte drive, float current);
|
void SetMotorCurrent(byte drive, float current);
|
||||||
|
@ -704,6 +707,7 @@ private:
|
||||||
int8_t enablePins[DRIVES];
|
int8_t enablePins[DRIVES];
|
||||||
bool disableDrives[DRIVES];
|
bool disableDrives[DRIVES];
|
||||||
bool driveEnabled[DRIVES];
|
bool driveEnabled[DRIVES];
|
||||||
|
bool directions[DRIVES];
|
||||||
int8_t lowStopPins[DRIVES];
|
int8_t lowStopPins[DRIVES];
|
||||||
int8_t highStopPins[DRIVES];
|
int8_t highStopPins[DRIVES];
|
||||||
float maxFeedrates[DRIVES];
|
float maxFeedrates[DRIVES];
|
||||||
|
@ -972,6 +976,16 @@ inline bool Platform::HighStopButNotLow(int8_t axis) const
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline void Platform::SetDirectionValue(byte drive, bool dVal)
|
||||||
|
{
|
||||||
|
directions[drive] = dVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Platform::GetDirectionValue(byte drive) const
|
||||||
|
{
|
||||||
|
return directions[drive];
|
||||||
|
}
|
||||||
|
|
||||||
inline float Platform::HomeFeedRate(int8_t axis) const
|
inline float Platform::HomeFeedRate(int8_t axis) const
|
||||||
{
|
{
|
||||||
return homeFeedrates[axis];
|
return homeFeedrates[axis];
|
||||||
|
|
Binary file not shown.
|
@ -343,7 +343,7 @@ void Webserver::ProcessGcode(const char* gc)
|
||||||
char c;
|
char c;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
bool reading_whitespace = false;
|
bool reading_whitespace = false;
|
||||||
while (i < ARRAY_UPB(gcodeReply) && configFile->Read(c))
|
while (i < gcodeReply.Length() - 1 && configFile->Read(c))
|
||||||
{
|
{
|
||||||
if (!reading_whitespace || (c != ' ' && c != '\t'))
|
if (!reading_whitespace || (c != ' ' && c != '\t'))
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue