Skip to content

Commit

Permalink
remove (unusable) M42, M226 commands, add delete option to M989
Browse files Browse the repository at this point in the history
  • Loading branch information
aegean-odyssey committed Dec 21, 2019
1 parent 19173d7 commit 5833afe
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions marlin_changes/HAL_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ extern CustomSerial Serial1;

#if OVERLY_SIMPLISTIC_OUTPUT_LOGGING_HACK
bool MarlinSerial_log(const char * file_name);
void MarlinSerial_log_rm(void);
#endif

#endif // __cplusplus
Expand Down
8 changes: 7 additions & 1 deletion marlin_changes/MarlinSerial_stm32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ static SdFile MS(LogFile);

bool MS(log)(const char * s)
{
SdFile * cwd = card.getWorkDir();
SdFile * cwd = card.getRootDir();

if (MS(LogFile).isOpen())
MS(LogFile).close();
Expand All @@ -565,6 +565,12 @@ bool MS(log)(const char * s)
? MS(LogFile).open(cwd, s, O_CREAT | O_WRITE)
: false;
}

void MS(log_rm)(void)
{
if (MS(LogFile).isOpen())
MS(LogFile).remove();
}
#endif

void MarlinSerial::write(const uint8_t c)
Expand Down
59 changes: 59 additions & 0 deletions marlin_changes/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7998,6 +7998,8 @@ inline void gcode_M31() {

#endif // SDSUPPORT

/* ###AO### */
#if ! MB(MALYAN_M300)
/**
* Sensitive pin test for M42, M226
*/
Expand Down Expand Up @@ -8047,6 +8049,7 @@ inline void gcode_M42() {
}
#endif
}
#endif // ! MB(MALYAN_M300)

#if ENABLED(PINS_DEBUGGING)

Expand Down Expand Up @@ -10391,6 +10394,50 @@ inline void gcode_M211() {

#endif // HOTENDS > 1

/* ###AO### */
#if MB(MALYAN_M300)

void serial_echo_percentage(const char * s, uint16_t i)
{
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(s, i);
SERIAL_CHAR('%');
SERIAL_EOL();
}

/**
* M220: Set speed percentage factor, aka "Feed Rate" (M220 S95)
*/
inline void gcode_M220()
{
if (parser.seenval('S')) {
feedrate_percentage = parser.value_int();
return;
}
serial_echo_percentage("Feed: ", feedrate_percentage);
}

/**
* M221: Set extrusion percentage (M221 T0 S95)
*/
inline void gcode_M221()
{
if (get_target_extruder_from_command(221))
return;

if (parser.seenval('S')) {
planner.flow_percentage[target_extruder] = parser.value_int();
planner.refresh_e_factor(target_extruder);
return;
}

// presume target extruder, E0 (saves space)
serial_echo_percentage("E0 Flow: ",
planner.flow_percentage[target_extruder]);
}

#else // !MB(MALYAN_M300)

/**
* M220: Set speed percentage factor, aka "Feed Rate" (M220 S95)
*/
Expand Down Expand Up @@ -10441,6 +10488,8 @@ inline void gcode_M226() {
} // parser.seen('P')
}

#endif // ! MB(MALYAN_M300)

#if ENABLED(EXPERIMENTAL_I2CBUS)

/**
Expand Down Expand Up @@ -13311,6 +13360,8 @@ void process_parsed_command() {
}
break;
case 989: // M989: stop logging output, close file
if (parser.seen('X'))
MarlinSerial_log_rm();
MarlinSerial_log(NULL);
break;
#endif
Expand All @@ -13320,7 +13371,11 @@ void process_parsed_command() {

case 31: gcode_M31(); break; // M31: Report print job elapsed time

/* ###AO### */
#if ! MB(MALYAN_M300)
case 42: gcode_M42(); break; // M42: Change pin state
#endif

#if ENABLED(PINS_DEBUGGING)
case 43: gcode_M43(); break; // M43: Read/monitor pin and endstop states
#endif
Expand Down Expand Up @@ -13476,7 +13531,11 @@ void process_parsed_command() {

case 220: gcode_M220(); break; // M220: Set Feedrate Percentage
case 221: gcode_M221(); break; // M221: Set Flow Percentage

/* ###AO### */
#if ! MB(MALYAN_M300)
case 226: gcode_M226(); break; // M226: Wait for Pin State
#endif

#if defined(CHDK) || HAS_PHOTOGRAPH
case 240: gcode_M240(); break; // M240: Trigger Camera
Expand Down

0 comments on commit 5833afe

Please sign in to comment.