Still hoping someone with some knowledge of the code might help here...
Never having looked at Marlin internals before I don't really have any clue what I'm doing, so more likely to break something than not (and given the time cost of each build/test cycle and the relative lack of interest in this this post it probably isn't worth pursuing, but these seem like potential points for code to enable the above steps.
I'm acually pretty suspicious I must be missing something, because on the face of it this seems such a basic enhancement, I would have thought it would have been done long ago.
I think also it would make more sense initially to use gcode_M118() [Marlin_main.cpp 8966] to echo a message to the host initially for testing then add the M117 feature later
Setting up a pin for the trigger (I use RAMPS, so everything refers to pins_RAMPS.h) I think initially I'd just hijack one of the runout pins
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN 19 // This co-opts pin used by #define Z_MAX_PIN 19
#endif
if you already have a runout system in place you could use one of the other 4 in runout.h
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#endif
Would it be reasonable to modify near the following code in runout.h (which is already being called by the runout pin interrupt) to increment the odometer?
Need to check if the runout interrupt is triggers by both rising and falling signal (which would be required by and encoder wheel). Also I'm not sure how Marlin currently compensates for jitter on the endstops, as this is very likely to be an issue with the wheel too.
Also the prepare_move_to_destination() bit code would have to set a flag if it's a retract (in which case the odometer would have to decrement)
inline void gcode_G0_G1(
...
FORCE_INLINE static void run() {
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
filament_ran_out = true;
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
planner.synchronize();
}
}
The looks like it probably refers to the the extruder current position (in Marlin_main.cpp 13651)
This would seem Iike a reasonable place to check that the filament odometer value is at the same point as the current position and set the retract flag for so the odometer was correctly incremented/decremented.
The alarm (step 3) looks like it could be triggered from anywhere with BUZZ(duration, frequency), so this section could sound this if there was a problem and somehow (?) queue the M118 message for the host;
void prepare_move_to_destination() {
...
if (!DEBUGGING(DRYRUN)) {
if (destination[E_AXIS] != current_position[E_AXIS]) {
#if ENABLED(PREVENT_COLD_EXTRUSION)
(obviously providing HAS_BUZZER == true which seems to be set if you have #define BEEPER_PIN in pins_RAMPS.h - this seems to be under LCD panel code, but there seems no reason a piezo couldn't be hooked up to any aux pin, so you could put this with #define SPEAKER in Configuration.h
[I'm not sure the difference between BUZZER and SPEAKER. the latter only seems to be used in buzzer.h for this code
#if ENABLED(SPEAKER)
CRITICAL_SECTION_START;
::tone(BEEPER_PIN, this->state.tone.frequency, this->state.tone.duration);
CRITICAL_SECTION_END;
Never having looked at Marlin internals before I don't really have any clue what I'm doing, so more likely to break something than not (and given the time cost of each build/test cycle and the relative lack of interest in this this post it probably isn't worth pursuing, but these seem like potential points for code to enable the above steps.
I'm acually pretty suspicious I must be missing something, because on the face of it this seems such a basic enhancement, I would have thought it would have been done long ago.
I think also it would make more sense initially to use gcode_M118() [Marlin_main.cpp 8966] to echo a message to the host initially for testing then add the M117 feature later
Setting up a pin for the trigger (I use RAMPS, so everything refers to pins_RAMPS.h) I think initially I'd just hijack one of the runout pins
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN 19 // This co-opts pin used by #define Z_MAX_PIN 19
#endif
if you already have a runout system in place you could use one of the other 4 in runout.h
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#endif
Would it be reasonable to modify near the following code in runout.h (which is already being called by the runout pin interrupt) to increment the odometer?
Need to check if the runout interrupt is triggers by both rising and falling signal (which would be required by and encoder wheel). Also I'm not sure how Marlin currently compensates for jitter on the endstops, as this is very likely to be an issue with the wheel too.
Also the prepare_move_to_destination() bit code would have to set a flag if it's a retract (in which case the odometer would have to decrement)
inline void gcode_G0_G1(
...
FORCE_INLINE static void run() {
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
filament_ran_out = true;
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
planner.synchronize();
}
}
The looks like it probably refers to the the extruder current position (in Marlin_main.cpp 13651)
This would seem Iike a reasonable place to check that the filament odometer value is at the same point as the current position and set the retract flag for so the odometer was correctly incremented/decremented.
The alarm (step 3) looks like it could be triggered from anywhere with BUZZ(duration, frequency), so this section could sound this if there was a problem and somehow (?) queue the M118 message for the host;
void prepare_move_to_destination() {
...
if (!DEBUGGING(DRYRUN)) {
if (destination[E_AXIS] != current_position[E_AXIS]) {
#if ENABLED(PREVENT_COLD_EXTRUSION)
(obviously providing HAS_BUZZER == true which seems to be set if you have #define BEEPER_PIN in pins_RAMPS.h - this seems to be under LCD panel code, but there seems no reason a piezo couldn't be hooked up to any aux pin, so you could put this with #define SPEAKER in Configuration.h
[I'm not sure the difference between BUZZER and SPEAKER. the latter only seems to be used in buzzer.h for this code
#if ENABLED(SPEAKER)
CRITICAL_SECTION_START;
::tone(BEEPER_PIN, this->state.tone.frequency, this->state.tone.duration);
CRITICAL_SECTION_END;