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 NAME "RepRapFirmware"
|
||||
#define VERSION "0.78j-dc42"
|
||||
#define DATE "2014-08-17"
|
||||
#define VERSION "0.78k-dc42"
|
||||
#define DATE "2014-08-18"
|
||||
#define AUTHORS "reprappro, dc42, zpl"
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
case 21: // Initialise SD - ignore
|
||||
break;
|
||||
|
||||
|
@ -2849,6 +2848,21 @@ bool GCodes::HandleMcode(GCodeBuffer* gb)
|
|||
}
|
||||
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
|
||||
{
|
||||
bool seen = false;
|
||||
|
|
3
Move.cpp
3
Move.cpp
|
@ -1199,7 +1199,8 @@ void DDA::Step()
|
|||
|
||||
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.
|
||||
// Maybe one day do a Runge-Kutta?
|
||||
|
|
56
Platform.cpp
56
Platform.cpp
|
@ -182,6 +182,7 @@ void Platform::Init()
|
|||
|
||||
stepPins = STEP_PINS;
|
||||
directionPins = DIRECTION_PINS;
|
||||
directions = DIRECTIONS;
|
||||
enablePins = ENABLE_PINS;
|
||||
disableDrives = DISABLE_DRIVES;
|
||||
lowStopPins = LOW_STOP_PINS;
|
||||
|
@ -986,13 +987,15 @@ void Platform::SetDirection(byte drive, bool direction)
|
|||
{
|
||||
if(directionPins[drive] < 0)
|
||||
return;
|
||||
|
||||
bool d = (direction == FORWARDS) ? directions[drive] : !directions[drive];
|
||||
if(drive == E0_DRIVE) //DIRECTION_PINS {15, 26, 4, X3, 35, 53, 51, 48}
|
||||
{
|
||||
digitalWriteNonDue(directionPins[drive], direction);
|
||||
digitalWriteNonDue(directionPins[drive], d);
|
||||
}
|
||||
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(drive == Z_AXIS || drive==E0_DRIVE || drive==E2_DRIVE) //ENABLE_PINS {29, 27, X1, X0, 37, X8, 50, 47}
|
||||
{
|
||||
digitalWriteNonDue(enablePins[drive], ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalWrite(enablePins[drive], ENABLE);
|
||||
}
|
||||
driveEnabled[drive] = true;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
|
@ -1571,44 +1578,21 @@ bool FileStore::Open(const char* directory, const char* fileName, bool write)
|
|||
const char* location = (directory != NULL)
|
||||
? platform->GetMassStorage()->CombineName(directory, fileName)
|
||||
: fileName;
|
||||
|
||||
writing = write;
|
||||
lastBufferEntry = FILE_BUF_LEN - 1;
|
||||
FRESULT openReturn;
|
||||
|
||||
if (writing)
|
||||
FRESULT openReturn = f_open(&file, location, (writing) ? FA_CREATE_ALWAYS | FA_WRITE : FA_OPEN_EXISTING | FA_READ);
|
||||
if (openReturn != FR_OK)
|
||||
{
|
||||
openReturn = f_open(&file, location, FA_CREATE_ALWAYS | FA_WRITE);
|
||||
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 write to, error code ");
|
||||
snprintf(errString, ARRAY_SIZE(errString), "%d", openReturn);
|
||||
platform->Message(HOST_MESSAGE, errString);
|
||||
platform->Message(HOST_MESSAGE, "\n");
|
||||
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;
|
||||
char errString[12]; // don't use scratch_string for this because that may be holding the original filename
|
||||
platform->Message(BOTH_MESSAGE, "Can't open ");
|
||||
platform->AppendMessage(BOTH_MESSAGE, location);
|
||||
platform->AppendMessage(BOTH_MESSAGE, (writing) ? " to write to, error code " : " to read from, error code ");
|
||||
snprintf(errString, ARRAY_SIZE(errString), "%d\n", openReturn);
|
||||
platform->AppendMessage(BOTH_MESSAGE, errString);
|
||||
return false;
|
||||
}
|
||||
|
||||
bufferPointer = (writing) ? 0 : FILE_BUF_LEN;
|
||||
inUse = true;
|
||||
openCount = 1;
|
||||
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 DIRECTION_PINS {15, 26, 4, X3, 35, 53, 51, 48}
|
||||
#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 false // What to send to enable...
|
||||
#define DISABLE true // ...and disable a drive
|
||||
|
@ -592,6 +593,8 @@ public:
|
|||
|
||||
void EmergencyStop();
|
||||
void SetDirection(byte drive, bool direction);
|
||||
void SetDirectionValue(byte drive, bool dVal);
|
||||
bool GetDirectionValue(byte drive) const;
|
||||
void Step(byte drive);
|
||||
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);
|
||||
|
@ -704,6 +707,7 @@ private:
|
|||
int8_t enablePins[DRIVES];
|
||||
bool disableDrives[DRIVES];
|
||||
bool driveEnabled[DRIVES];
|
||||
bool directions[DRIVES];
|
||||
int8_t lowStopPins[DRIVES];
|
||||
int8_t highStopPins[DRIVES];
|
||||
float maxFeedrates[DRIVES];
|
||||
|
@ -972,6 +976,16 @@ inline bool Platform::HighStopButNotLow(int8_t axis) const
|
|||
}
|
||||
#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
|
||||
{
|
||||
return homeFeedrates[axis];
|
||||
|
|
Binary file not shown.
|
@ -343,7 +343,7 @@ void Webserver::ProcessGcode(const char* gc)
|
|||
char c;
|
||||
size_t i = 0;
|
||||
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'))
|
||||
{
|
||||
|
|
Reference in a new issue