This commit is contained in:
Alexander Richter 2022-11-25 23:58:31 +01:00
commit 300cc30d79

View File

@ -68,7 +68,7 @@
#define AINPUTS #define AINPUTS
#ifdef AINPUTS #ifdef AINPUTS
const int AInputs = 1; const int AInputs = 1;
int AInPinmap[] = {94}; //Potentiometer for SpindleSpeed override int AInPinmap[] = {1}; //Potentiometer for SpindleSpeed override
int smooth = 200; //number of samples to denoise ADC, try lower numbers on your setup int smooth = 200; //number of samples to denoise ADC, try lower numbers on your setup
#endif #endif
@ -76,8 +76,8 @@
#ifdef LPOTIS #ifdef LPOTIS
const int LPotis = 2; const int LPotis = 2;
int LPotiPins[LPotis][2] = { int LPotiPins[LPotis][2] = {
{96,9}, //Latching Knob Spindle Overdrive on A1, has 9 Positions {2,9}, //Latching Knob Spindle Overdrive on A1, has 9 Positions
{95,4} //Latching Knob Feed Resolution on A2, has 4 Positions {3,4} //Latching Knob Feed Resolution on A2, has 4 Positions
}; };
int margin = 20; //giving it some margin so Numbers dont jitter, make this number smaller if your knob has more than 50 Positions int margin = 20; //giving it some margin so Numbers dont jitter, make this number smaller if your knob has more than 50 Positions
#endif #endif
@ -194,7 +194,7 @@ void setup() {
while (lastcom == 0){ while (lastcom == 0){
readCommands(); readCommands();
flushSerial(); flushSerial();
Serial.println("R:"); Serial.println("E0:0");
#ifdef STATUSLED #ifdef STATUSLED
StatLedErr(1000,1000); StatLedErr(1000,1000);
#endif #endif
@ -301,15 +301,12 @@ int readAInputs(){
for(int i= 0;i<smooth; i++){// take couple samples to denoise signal for(int i= 0;i<smooth; i++){// take couple samples to denoise signal
var = var+ analogRead(AInPinmap[i]); var = var+ analogRead(AInPinmap[i]);
} }
var = var / smooth; var = var / smooth;
if(oldAinput[i]!= var){ if(oldAinput[i]!= var){
oldAinput[i] = var; oldAinput[i] = var;
sendData('A',AInPinmap[i],oldAinput[i]); sendData('A',AInPinmap[i],oldAinput[i]);
} }
} }
} }
void readInputs(){ void readInputs(){
@ -341,7 +338,7 @@ int readAbsKnob(){
var += 16; var += 16;
} }
if(var != oldAbsEncState){ if(var != oldAbsEncState){
Serial.print("K:"); Serial.print("K0:");
Serial.println(var); Serial.println(var);
} }
oldAbsEncState = var; oldAbsEncState = var;