|
|
|
@@ -7,6 +7,9 @@ |
|
|
|
|
|
|
|
#include "RouterSetup.h"
|
|
|
|
|
|
|
|
#include <HardwareSerial.h>
|
|
|
|
#include <WString.h>
|
|
|
|
|
|
|
|
|
|
|
|
/******************
|
|
|
|
** Constructors
|
|
|
|
@@ -185,6 +188,7 @@ void RouterSetup::onRotaryControlerTurn(RotaryEncoder::Direction turn) { |
|
|
|
if (turn != RotaryEncoder::Direction::NOROTATION) {
|
|
|
|
|
|
|
|
String value = "";
|
|
|
|
int index = 0;
|
|
|
|
int sign = (turn == RotaryEncoder::Direction::CLOCKWISE) ? 1 : -1;
|
|
|
|
String unit = getCfgOptUnitForStepIndex(configStepIndex);
|
|
|
|
|
|
|
|
@@ -198,8 +202,12 @@ void RouterSetup::onRotaryControlerTurn(RotaryEncoder::Direction turn) { |
|
|
|
value = String(getAcceleration(), 1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
setStepsPerRev(getStepsPerRev() + 1 * sign);
|
|
|
|
value = String(getStepsPerRev());
|
|
|
|
index = getIndexOfStepsPerRevValue(getStepsPerRev());
|
|
|
|
if (index > -1) {
|
|
|
|
index = min(max((index + 1 * sign), 0), StepsPerRevOptsSize - 1) % 5;
|
|
|
|
setStepsPerRev(StepsPerRevolutionOptions[index]);
|
|
|
|
value = String(getStepsPerRev());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
setPitch(getPitch() + 0.1 * sign);
|
|
|
|
@@ -299,3 +307,12 @@ String RouterSetup::getCfgOptUnitForStepIndex(byte configStepIndex) { |
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int RouterSetup::getIndexOfStepsPerRevValue(uint16_t value) {
|
|
|
|
for (int i = 0; i < sizeof(StepsPerRevolutionOptions); i++) {
|
|
|
|
if (StepsPerRevolutionOptions[i] == value) {
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|