M591 Cleanup and tweaks
This commit is contained in:
@@ -70,7 +70,7 @@ void GcodeSuite::M591() {
|
||||
if (parser.seen('L')) runout.set_runout_distance(parser.value_linear_units(), tool);
|
||||
if (parser.seen('P')) {
|
||||
uint8_t tmp_mode = parser.value_int();
|
||||
if(tmp_mode > 3 || tmp_mode==7) {
|
||||
if(tmp_mode < 3 || tmp_mode==7) {
|
||||
runout.mode[tool] = tmp_mode;
|
||||
runout.reset();
|
||||
}
|
||||
|
||||
@@ -583,21 +583,24 @@ void _O2 Endstops::report_states() {
|
||||
default: continue;
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
|
||||
}
|
||||
if(runout.mode[i]==1)
|
||||
if(runout.mode[i-1]==1)
|
||||
state = HIGH;
|
||||
else
|
||||
state = LOW;
|
||||
|
||||
SERIAL_ECHOPGM(STR_FILAMENT);
|
||||
if (i > 1) SERIAL_CHAR(' ', '0' + i);
|
||||
print_es_state(extDigitalRead(pin) != state);
|
||||
SERIAL_ECHOPGM(": ");
|
||||
if(runout.mode[i]==0)
|
||||
SERIAL_ECHOLNF(F("Sensor Disabled"));
|
||||
if(runout.mode[i-1]==0)
|
||||
SERIAL_ECHOLNF(F("DISABLED"));
|
||||
else if(runout.mode[i-1]==7) {
|
||||
SERIAL_ECHOF(F("MOTION : "));
|
||||
print_es_state(extDigitalRead(pin) != state);
|
||||
}
|
||||
else if(extDigitalRead(pin) != state)
|
||||
SERIAL_ECHOLNF(F("Fil Present"));
|
||||
SERIAL_ECHOLNF(F("PRESENT"));
|
||||
else
|
||||
SERIAL_ECHOLNF(F("Fil Missing"));
|
||||
SERIAL_ECHOLNF(F("MISSING"));
|
||||
}
|
||||
#undef _CASE_RUNOUT
|
||||
#endif
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
// Change EEPROM version if the structure changes
|
||||
#define EEPROM_VERSION "V86"
|
||||
#define EEPROM_VERSION "V87"
|
||||
#define EEPROM_OFFSET 100
|
||||
|
||||
// Check the integrity of data offsets.
|
||||
@@ -794,18 +794,18 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
{
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_WRITE(runout.enabled[e]);
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_WRITE(runout.runout_distance(e));
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_WRITE(runout.mode[e]);
|
||||
#else
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_WRITE((int8_t)-1));
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_WRITE((float)-0.0f));
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_WRITE((uint8_t)0));
|
||||
#endif
|
||||
}
|
||||
@@ -1715,21 +1715,21 @@ void MarlinSettings::postprocess() {
|
||||
{
|
||||
int8_t runout_sensor_enabled[HOTENDS];
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_READ(runout_sensor_enabled);
|
||||
float runout_distance_mm[HOTENDS];
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_READ(runout_distance_mm[e]);
|
||||
uint8_t runout_mode[HOTENDS];
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
EEPROM_READ(runout_mode[e]);
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
runout.enabled[e] = runout_sensor_enabled[e] < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled[e];
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
if (!validating) runout.set_runout_distance(runout_distance_mm[e], e);
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
if (!validating) runout.mode[e] = runout_mode[e];
|
||||
runout.reset();
|
||||
#endif
|
||||
@@ -2798,11 +2798,11 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
runout.enabled[e] = FIL_RUNOUT_ENABLED_DEFAULT;
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM, e);
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
runout.mode[e] = FILAMENT_RUNOUT_DEFAULT_MODE;
|
||||
|
||||
runout.reset();
|
||||
|
||||
Reference in New Issue
Block a user