Skip to content

Commit

Permalink
#28 reanmed switchId parameter added doc for switchId parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
pkerspe committed Aug 16, 2021
1 parent 9dd479c commit ce06c41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ The following is an excerpt of the endpoints being provided:
| METHOD | PATH | DESCRIPTION |
|---|---|---|
|GET |`/api/status`|get the current stepper server status report including the following information: version string of the server, wifi information (wifi mode, IP address), spiffs information (total space and free space)|
|POST |`/api/steppers/returnhome`|endpoint to trigger homing of the stepper motor. This is a non blocking call, meaning the API will directly return even though the stepper motor is still performing the homing movement.<br /><br />*IMPORTANT:* this function should only be called if you previously configured a homing / limit switch for this stepper motor, otherwise the stepper will start jogging for a long time (a default limit of 2000000000 steps is configured, but can be overwritten with a POST parameter) before coming to a halt.<br/><br />*Required post parameters:*<br />__id__: the id of the stepper motor to pefrom the homing command for)<br />__speed__: the speed in steps per second to perform the homing command with<br /><br />*Optional POST parameters:*<br />__direction__: the homing direction for the stepper movement. Could be either 1 or -1. If parameter is not given the direction will be determined from the limit switch configuration (depending on the switch type "begin" or "end")<br/>__accel__: the acceleration for the homing procedure in steps/sec^2, if ommitted the previously defined acceleration in the flexy stepper instance will be used<br />__maxSteps__: this parameter defines the maximum number of steps to perform before cancelling the homing procedure. This is kind of a safeguard to prevent endless spinning of the stepper motor. Defaults to 2000000000 steps|
|POST |`/api/steppers/returnhome`|endpoint to trigger homing of the stepper motor. This is a non blocking call, meaning the API will directly return even though the stepper motor is still performing the homing movement.<br /><br />*IMPORTANT:* this function should only be called if you previously configured a homing / limit switch for this stepper motor, otherwise the stepper will start jogging for a long time (a default limit of 2000000000 steps is configured, but can be overwritten with a POST parameter) before coming to a halt.<br/><br />*Required post parameters:*<br />__id__: the id of the stepper motor to pefrom the homing command for)<br />__speed__: the speed in steps per second to perform the homing command with<br /><br />*Optional POST parameters:*<br/>__switchId__: define the configuration id of the position switch to use as limit switch. __NOTE__: this switch should be assigned to the stepper motor, so you should not provide the id of a position switch that is not linked to the stepper driver defined in the mandatory __id__ parameter. Ideally the switch is also configured as a limit type switch.<br />__direction__: the homing direction for the stepper movement. Could be either 1 or -1. If parameter is not given the direction will be determined from the limit switch configuration (depending on the switch type "begin" or "end")<br/>__accel__: the acceleration for the homing procedure in steps/sec^2, if ommitted the previously defined acceleration in the flexy stepper instance will be used<br />__maxSteps__: this parameter defines the maximum number of steps to perform before cancelling the homing procedure. This is kind of a safeguard to prevent endless spinning of the stepper motor. Defaults to 2000000000 steps|
|POST|`/api/steppers/moveby`|endpoint to set a new RELATIVE target position for the stepper motor in either mm, revs or steps. Required post parameters: id, unit, value. Optional post parameters: speed, acel, decel|
|POST |`/api/steppers/position`|endpoint to set a new absolute target position for the stepper motor in either mm, revs or steps. Required post parameters: id, unit, value. Optional post parameters: speed, acel, decel|
| GET |`/api/steppers` or `/api/steppers?id=<id>`|endpoint to list all configured steppers or a specific one if "id" query parameter is given
Expand Down
4 changes: 2 additions & 2 deletions src/ESPStepperMotorServer_RestAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ void ESPStepperMotorServer_RestAPI::handleHomingRequest(AsyncWebServerRequest *r

byte gpioPinForSwitch = 0;
//TOOD: implement proper ISR handling for custom switch parameter if not linked to existing stepper
if (request->hasParam("switchid"))
if (request->hasParam("switchId"))
{
int switchIndex = request->getParam("switchid")->value().toInt();
int switchIndex = request->getParam("switchId")->value().toInt();
switchConfig = this->_stepperMotorServer->getCurrentServerConfiguration()->getSwitch(switchIndex);
if (switchConfig == NULL)
{
Expand Down

0 comments on commit ce06c41

Please sign in to comment.