foolproofed steps/mm setting (must be > 0)

This commit is contained in:
Simen Svale Skogsrud 2011-02-25 13:40:48 +01:00
parent 4cac11ec86
commit cd074bc590

View File

@ -139,6 +139,10 @@ int read_settings() {
void settings_store_setting(int parameter, double value) { void settings_store_setting(int parameter, double value) {
switch(parameter) { switch(parameter) {
case 0: case 1: case 2: case 0: case 1: case 2:
if (value <= 0.0) {
printPgmString(PSTR("Steps/mm must be > 0.0\r\n"));
return;
}
settings.steps_per_mm[parameter] = value; break; settings.steps_per_mm[parameter] = value; break;
case 3: settings.pulse_microseconds = round(value); break; case 3: settings.pulse_microseconds = round(value); break;
case 4: settings.default_feed_rate = value; break; case 4: settings.default_feed_rate = value; break;