Skip to content

Commit

Permalink
Merge pull request #14 from MarlinFirmware/RCBugFix
Browse files Browse the repository at this point in the history
Rc bug fix
  • Loading branch information
esenapaj committed Feb 19, 2016
2 parents ab5aa3f + 0c9db67 commit 34cde1b
Show file tree
Hide file tree
Showing 51 changed files with 213 additions and 4,940 deletions.
3 changes: 3 additions & 0 deletions Marlin/Conditionals.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE))
#define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
Expand All @@ -472,6 +473,7 @@
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
Expand All @@ -482,6 +484,7 @@
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E4_STEP (PIN_EXISTS(E4_STEP))

/**
* Helper Macros for heaters and extruder fan
Expand Down
5 changes: 2 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,8 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
//#define ULTRA_LCD //general LCD support, also 16x2
//#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
//#define SDSUPPORT // Enable SD Card Support in Hardware Console
// Changed behaviour! If you need SDSUPPORT uncomment it!
//#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
//#define SDEXTRASLOW // Use even slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
// Changed behaviour! If you need SDSUPPORT uncomment it!
//#define SPI_SPEED SPI_HALF_SPEED // (also SPI_QUARTER_SPEED, SPI_EIGHTH_SPEED) 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 1 // Increase if you have a high resolution encoder
//#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
Expand Down
69 changes: 34 additions & 35 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
* - http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
*
* Help us document these G-codes online:
* - http://marlinfirmware.org/index.php/G-Code
* - https://github.com/MarlinFirmware/Marlin/wiki/G-Code-in-Marlin
* - http://reprap.org/wiki/G-code
*
* -----------------
Expand Down Expand Up @@ -973,6 +973,7 @@ void get_command() {
bool code_has_value() {
int i = 1;
char c = seen_pointer[i];
while (c == ' ') c = seen_pointer[++i];
if (c == '-' || c == '+') c = seen_pointer[++i];
if (c == '.') c = seen_pointer[++i];
return (c >= '0' && c <= '9');
Expand Down Expand Up @@ -4749,19 +4750,18 @@ inline void gcode_M226() {
if (servo_index >= 0 && servo_index < NUM_SERVOS)
servo[servo_index].move(servo_position);
else {
SERIAL_ECHO_START;
SERIAL_ECHO("Servo ");
SERIAL_ECHO(servo_index);
SERIAL_ECHOLN(" out of range");
SERIAL_ERROR_START;
SERIAL_ERROR("Servo ");
SERIAL_ERROR(servo_index);
SERIAL_ERRORLN(" out of range");
}
}
else if (servo_index >= 0) {
SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" Servo ");
SERIAL_PROTOCOL(servo_index);
SERIAL_PROTOCOL(": ");
SERIAL_PROTOCOL(servo[servo_index].read());
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHO(" Servo ");
SERIAL_ECHO(servo_index);
SERIAL_ECHO(": ");
SERIAL_ECHOLN(servo[servo_index].read());
}
}

Expand Down Expand Up @@ -4812,27 +4812,27 @@ inline void gcode_M226() {
#endif

updatePID();
SERIAL_PROTOCOL(MSG_OK);
SERIAL_ECHO_START;
#if ENABLED(PID_PARAMS_PER_EXTRUDER)
SERIAL_PROTOCOL(" e:"); // specify extruder in serial output
SERIAL_PROTOCOL(e);
SERIAL_ECHO(" e:"); // specify extruder in serial output
SERIAL_ECHO(e);
#endif // PID_PARAMS_PER_EXTRUDER
SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(PID_PARAM(Kp, e));
SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(unscalePID_i(PID_PARAM(Ki, e)));
SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOL(unscalePID_d(PID_PARAM(Kd, e)));
SERIAL_ECHO(" p:");
SERIAL_ECHO(PID_PARAM(Kp, e));
SERIAL_ECHO(" i:");
SERIAL_ECHO(unscalePID_i(PID_PARAM(Ki, e)));
SERIAL_ECHO(" d:");
SERIAL_ECHO(unscalePID_d(PID_PARAM(Kd, e)));
#if ENABLED(PID_ADD_EXTRUSION_RATE)
SERIAL_PROTOCOL(" c:");
SERIAL_ECHO(" c:");
//Kc does not have scaling applied above, or in resetting defaults
SERIAL_PROTOCOL(PID_PARAM(Kc, e));
SERIAL_ECHO(PID_PARAM(Kc, e));
#endif
SERIAL_EOL;
}
else {
SERIAL_ECHO_START;
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
SERIAL_ERROR_START;
SERIAL_ERRORLN(MSG_INVALID_EXTRUDER);
}
}

Expand All @@ -4846,14 +4846,13 @@ inline void gcode_M226() {
if (code_seen('D')) bedKd = scalePID_d(code_value());

updatePID();
SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(bedKp);
SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(unscalePID_i(bedKi));
SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOL(unscalePID_d(bedKd));
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHO(" p:");
SERIAL_ECHO(bedKp);
SERIAL_ECHO(" i:");
SERIAL_ECHO(unscalePID_i(bedKi));
SERIAL_ECHO(" d:");
SERIAL_ECHOLN(unscalePID_d(bedKd));
}

#endif // PIDTEMPBED
Expand Down Expand Up @@ -5285,7 +5284,7 @@ inline void gcode_M503() {
float value = code_value();
if (Z_PROBE_OFFSET_RANGE_MIN <= value && value <= Z_PROBE_OFFSET_RANGE_MAX) {
zprobe_zoffset = value;
SERIAL_ECHOPGM(MSG_OK);
SERIAL_ECHO(zprobe_zoffset);
}
else {
SERIAL_ECHOPGM(MSG_Z_MIN);
Expand Down Expand Up @@ -5691,7 +5690,7 @@ void process_next_command() {

// Sanitize the current command:
// - Skip leading spaces
// - Bypass N[0-9][0-9]*[ ]*
// - Bypass N[-0-9][0-9]*[ ]*
// - Overwrite * with nul to mark the end
while (*current_command == ' ') ++current_command;
if (*current_command == 'N' && ((current_command[1] >= '0' && current_command[1] <= '9') || current_command[1] == '-')) {
Expand All @@ -5716,7 +5715,7 @@ void process_next_command() {
// Args pointer optimizes code_seen, especially those taking XYZEF
// This wastes a little cpu on commands that expect no arguments.
current_command_args = current_command;
while (*current_command_args && *current_command_args != ' ') ++current_command_args;
while (*current_command_args >= '0' && *current_command_args <= '9') ++current_command_args;
while (*current_command_args == ' ') ++current_command_args;

// Interpret the code int
Expand Down
4 changes: 4 additions & 0 deletions Marlin/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@
#error HAS_AUTOMATIC_VERSIONING deprecated - use USE_AUTOMATIC_VERSIONING instead
#elif defined(ENABLE_AUTO_BED_LEVELING)
#error ENABLE_AUTO_BED_LEVELING deprecated - use AUTO_BED_LEVELING_FEATURE instead
#elif defined(SDSLOW)
#error SDSLOW deprecated - set SPI_SPEED to SPI_HALF_SPEED instead
#elif defined(SDEXTRASLOW)
#error SDEXTRASLOW deprecated - set SPI_SPEED to SPI_QUARTER_SPEED instead
#endif

#endif //SANITYCHECK_H
6 changes: 3 additions & 3 deletions Marlin/SdBaseFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ bool SdBaseFile::getFilename(char* name) {
return true;
}
//------------------------------------------------------------------------------
void SdBaseFile::getpos(fpos_t* pos) {
void SdBaseFile::getpos(filepos_t* pos) {
pos->position = curPosition_;
pos->cluster = curCluster_;
}
Expand Down Expand Up @@ -923,7 +923,7 @@ bool SdBaseFile::openRoot(SdVolume* vol) {
* \return The byte if no error and not at eof else -1;
*/
int SdBaseFile::peek() {
fpos_t pos;
filepos_t pos;
getpos(&pos);
int c = read();
if (c >= 0) setpos(&pos);
Expand Down Expand Up @@ -1479,7 +1479,7 @@ bool SdBaseFile::seekSet(uint32_t pos) {
return false;
}
//------------------------------------------------------------------------------
void SdBaseFile::setpos(fpos_t* pos) {
void SdBaseFile::setpos(filepos_t* pos) {
curPosition_ = pos->position;
curCluster_ = pos->cluster;
}
Expand Down
10 changes: 5 additions & 5 deletions Marlin/SdBaseFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
#include "SdVolume.h"
//------------------------------------------------------------------------------
/**
* \struct fpos_t
* \struct filepos_t
* \brief internal type for istream
* do not use in user apps
*/
struct fpos_t {
struct filepos_t {
/** stream position */
uint32_t position;
/** cluster for position */
uint32_t cluster;
fpos_t() : position(0), cluster(0) {}
filepos_t() : position(0), cluster(0) {}
};

// use the gnu style oflag in open()
Expand Down Expand Up @@ -196,11 +196,11 @@ class SdBaseFile {
/** get position for streams
* \param[out] pos struct to receive position
*/
void getpos(fpos_t* pos);
void getpos(filepos_t* pos);
/** set position for streams
* \param[out] pos struct with value for new position
*/
void setpos(fpos_t* pos);
void setpos(filepos_t* pos);
//----------------------------------------------------------------------------
bool close();
bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock);
Expand Down
Loading

0 comments on commit 34cde1b

Please sign in to comment.