Skip to content

Commit

Permalink
fixed persistance and loading of break settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pkerspe committed Mar 19, 2022
1 parent ae128f6 commit 789cfe9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "git",
"url": "https://github.com/pkerspe/ESP-StepperMotor-Server.git"
},
"version": "0.4.7",
"version": "0.4.8",
"license": "MIT",
"frameworks": "arduino",
"platforms": [
Expand All @@ -28,7 +28,7 @@
},
{
"name": "ArduinoJSON",
"version": "6.15.2",
"version": "6.19.2",
"platforms": "arduino"
},
{
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP-StepperMotor-Server
version=0.4.7
version=0.4.8
author=Paul Kerspe
maintainer=Paul Kerspe
sentence=A stepper motor control server for ESP32 with Web UI, REST API and CLI
Expand Down
12 changes: 6 additions & 6 deletions src/ESPStepperMotorServer_Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ bool ESPStepperMotorServer_Configuration::saveCurrentConfiguationToSpiffs(String

// Close the file
file.close();

return success;
}

Expand Down Expand Up @@ -313,12 +314,11 @@ bool ESPStepperMotorServer_Configuration::loadConfiguationFromSpiffs(String file
(stepperConfigEntry["microsteppingDivisor"] | ESPSMS_MICROSTEPS_OFF),
(stepperConfigEntry["rpmLimit"] | 1000));

//check if break pin is used at all
if(stepperConfig->getBrakeIoPin() != stepperConfig->ESPServerStepperUnsetIoPinNumber){
stepperConfig->setBrakeIoPin(stepperConfigEntry["breakPin"] | stepperConfig->ESPServerStepperUnsetIoPinNumber, stepperConfigEntry["breakPinActiveState"] | 1);
stepperConfig->setBrakeEngageDelayMs(stepperConfigEntry["breakEngageDelay"] | 0);
stepperConfig->setBrakeReleaseDelayMs(stepperConfigEntry["breakReleaseDelay"] | -1);
}
//set break settings
stepperConfig->setBrakeIoPin(stepperConfigEntry["breakPin"] | stepperConfig->ESPServerStepperUnsetIoPinNumber, stepperConfigEntry["breakPinActiveState"] | 1);
stepperConfig->setBrakeEngageDelayMs(stepperConfigEntry["breakEngageDelay"] | 0);
stepperConfig->setBrakeReleaseDelayMs(stepperConfigEntry["breakReleaseDelay"] | -1);

if (stepperConfigEntry["id"])
{
this->setStepperConfiguration(stepperConfig, stepperConfigEntry["id"]);
Expand Down

0 comments on commit 789cfe9

Please sign in to comment.