debugging writing of encoder parameter writing
parent
1352bc751e
commit
96b8608db1
10
src/Config.h
10
src/Config.h
|
@ -71,15 +71,15 @@ const long ENCODER_MISSED_STEPS_MAX_X_DEFAULT = 10;
|
|||
const long ENCODER_MISSED_STEPS_MAX_Y_DEFAULT = 10;
|
||||
const long ENCODER_MISSED_STEPS_MAX_Z_DEFAULT = 10;
|
||||
|
||||
// How much a good step is substracted from the missed step total (1-10)
|
||||
const long ENCODER_MISSED_STEPS_DECAY_X_DEFAULT = 1;
|
||||
const long ENCODER_MISSED_STEPS_DECAY_Y_DEFAULT = 1;
|
||||
const long ENCODER_MISSED_STEPS_DECAY_Z_DEFAULT = 1;
|
||||
// How much a good step is substracted from the missed step total (1-99)
|
||||
const long ENCODER_MISSED_STEPS_DECAY_X_DEFAULT = 10;
|
||||
const long ENCODER_MISSED_STEPS_DECAY_Y_DEFAULT = 10;
|
||||
const long ENCODER_MISSED_STEPS_DECAY_Z_DEFAULT = 10;
|
||||
|
||||
|
||||
const long STATUS_GENERAL_DEFAULT = 0;
|
||||
|
||||
|
||||
const String SOFTWARE_VERSION = "GENESIS V.01.04";
|
||||
const String SOFTWARE_VERSION = "GENESIS V.01.05";
|
||||
|
||||
#endif /* CONFIG_H_ */
|
||||
|
|
|
@ -112,10 +112,11 @@ bool ParameterList::validParam(int id) {
|
|||
int ParameterList::writeValue(int id, long value) {
|
||||
|
||||
if (validParam(id)) {
|
||||
Serial.print("R99 param accepted \n");
|
||||
paramValues[id] = value;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Serial.print("R99");
|
||||
Serial.print(" ");
|
||||
Serial.print("writeValue");
|
||||
|
@ -128,7 +129,7 @@ int ParameterList::writeValue(int id, long value) {
|
|||
Serial.print(" ");
|
||||
Serial.print(value);
|
||||
Serial.print("\n");
|
||||
*/
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -154,16 +155,16 @@ int ParameterList::readValue(int id) {
|
|||
|
||||
long ParameterList::getValue(int id) {
|
||||
|
||||
/*
|
||||
|
||||
Serial.print("R99");
|
||||
Serial.print(" ");
|
||||
Serial.print("getValue");
|
||||
Serial.print(" id ");
|
||||
Serial.print(id);
|
||||
Serial.print(" value");
|
||||
Serial.print(" value ");
|
||||
Serial.print(paramValues[id]);
|
||||
Serial.print("\n");
|
||||
*/
|
||||
|
||||
|
||||
return paramValues[id];
|
||||
}
|
||||
|
|
|
@ -44,22 +44,22 @@ enum ParamListEnum
|
|||
MOVEMENT_MAX_SPD_Z = 73,
|
||||
|
||||
// encoder settings
|
||||
ENCODER_ENABLED_X = 701,
|
||||
ENCODER_ENABLED_Y = 702,
|
||||
ENCODER_ENABLED_Z = 703,
|
||||
ENCODER_ENABLED_X = 101,
|
||||
ENCODER_ENABLED_Y = 102,
|
||||
ENCODER_ENABLED_Z = 103,
|
||||
|
||||
ENCODER_MISSED_STEPS_MAX_X = 711,
|
||||
ENCODER_MISSED_STEPS_MAX_Y = 712,
|
||||
ENCODER_MISSED_STEPS_MAX_Z = 713,
|
||||
ENCODER_MISSED_STEPS_MAX_X = 111,
|
||||
ENCODER_MISSED_STEPS_MAX_Y = 112,
|
||||
ENCODER_MISSED_STEPS_MAX_Z = 113,
|
||||
|
||||
ENCODER_MISSED_STEPS_DECAY_X = 721,
|
||||
ENCODER_MISSED_STEPS_DECAY_Y = 722,
|
||||
ENCODER_MISSED_STEPS_DECAY_Z = 723,
|
||||
ENCODER_MISSED_STEPS_DECAY_X = 121,
|
||||
ENCODER_MISSED_STEPS_DECAY_Y = 122,
|
||||
ENCODER_MISSED_STEPS_DECAY_Z = 123,
|
||||
|
||||
// not used in software at this time
|
||||
MOVEMENT_AXIS_NR_STEPS_X = 801,
|
||||
MOVEMENT_AXIS_NR_STEPS_Y = 802,
|
||||
MOVEMENT_AXIS_NR_STEPS_Z = 803
|
||||
MOVEMENT_AXIS_NR_STEPS_X = 141,
|
||||
MOVEMENT_AXIS_NR_STEPS_Y = 142,
|
||||
MOVEMENT_AXIS_NR_STEPS_Z = 143
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -671,7 +671,7 @@ void StepperControl::checkAxisVsEncoder(StepperControlAxis* axis, StepperControl
|
|||
|
||||
// If a step is done
|
||||
//if (axis->isStepDone() && axis->currentPosition() % 3 == 0) {
|
||||
if (encoderEnabled && axis->isStepDone()) {
|
||||
if (*encoderEnabled && axis->isStepDone()) {
|
||||
|
||||
bool stepMissed = false;
|
||||
|
||||
|
@ -814,13 +814,17 @@ void StepperControl::loadEncoderSettings() {
|
|||
motorConsMissedStepsMax[1] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_MAX_Y);
|
||||
motorConsMissedStepsMax[2] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_MAX_Z);
|
||||
|
||||
motorConsMissedStepsDecay[0] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_DECAY_X) / 10;
|
||||
motorConsMissedStepsDecay[1] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_DECAY_Y) / 10;
|
||||
motorConsMissedStepsDecay[2] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_DECAY_Z) / 10;
|
||||
motorConsMissedStepsDecay[0] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_DECAY_X);
|
||||
motorConsMissedStepsDecay[1] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_DECAY_Y);
|
||||
motorConsMissedStepsDecay[2] = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_DECAY_Z);
|
||||
|
||||
motorConsMissedStepsDecay[0] = min(max(motorConsMissedStepsDecay[0],0.1),1);
|
||||
motorConsMissedStepsDecay[1] = min(max(motorConsMissedStepsDecay[1],0.1),1);
|
||||
motorConsMissedStepsDecay[2] = min(max(motorConsMissedStepsDecay[2],0.1),1);
|
||||
motorConsMissedStepsDecay[0] = motorConsMissedStepsDecay[0] / 100;
|
||||
motorConsMissedStepsDecay[1] = motorConsMissedStepsDecay[1] / 100;
|
||||
motorConsMissedStepsDecay[2] = motorConsMissedStepsDecay[2] / 100;
|
||||
|
||||
motorConsMissedStepsDecay[0] = min(max(motorConsMissedStepsDecay[0],0.01),99);
|
||||
motorConsMissedStepsDecay[1] = min(max(motorConsMissedStepsDecay[1],0.01),99);
|
||||
motorConsMissedStepsDecay[2] = min(max(motorConsMissedStepsDecay[2],0.01),99);
|
||||
|
||||
if (ParameterList::getInstance()->getValue(ENCODER_ENABLED_X) == 1) {
|
||||
motorConsEncoderEnabled[0] = true;
|
||||
|
@ -828,6 +832,10 @@ void StepperControl::loadEncoderSettings() {
|
|||
motorConsEncoderEnabled[0] = false;
|
||||
}
|
||||
|
||||
Serial.print("R99 encoder enabled x: ");
|
||||
Serial.print(motorConsEncoderEnabled[0]);
|
||||
Serial.print("\n");
|
||||
|
||||
if (ParameterList::getInstance()->getValue(ENCODER_ENABLED_Y) == 1) {
|
||||
motorConsEncoderEnabled[1] = true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue