synchronising Settings
nothing important here
This commit is contained in:
parent
036cd64a13
commit
6971d0a677
@ -46,8 +46,8 @@
|
|||||||
|
|
||||||
|
|
||||||
//###IO's###
|
//###IO's###
|
||||||
#define DINPUTS
|
#define INPUTS
|
||||||
#ifdef DINPUTS
|
#ifdef INPUTS
|
||||||
const int Inputs = 16; //number of inputs using internal Pullup resistor. (short to ground to trigger)
|
const int Inputs = 16; //number of inputs using internal Pullup resistor. (short to ground to trigger)
|
||||||
int InPinmap[] = {32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48};
|
int InPinmap[] = {32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48};
|
||||||
#endif
|
#endif
|
||||||
@ -68,7 +68,7 @@
|
|||||||
#define AINPUTS
|
#define AINPUTS
|
||||||
#ifdef AINPUTS
|
#ifdef AINPUTS
|
||||||
const int AInputs = 1;
|
const int AInputs = 1;
|
||||||
int AInPinmap[] = {A3}; //Potentiometer for SpindleSpeed override
|
int AInPinmap[] = {94}; //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,8}, //Latching Knob Spindle Overdrive on A1, has 9 Positions
|
{96,9}, //Latching Knob Spindle Overdrive on A1, has 9 Positions
|
||||||
{95,3} //Latching Knob Feed Resolution on A2, has 4 Positions
|
{95,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
|
||||||
@ -98,10 +98,10 @@
|
|||||||
//###Misc Settings###
|
//###Misc Settings###
|
||||||
const int timeout = 10000; // timeout after 10 sec not receiving Stuff
|
const int timeout = 10000; // timeout after 10 sec not receiving Stuff
|
||||||
|
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
//Variables for Saving States
|
//Variables for Saving States
|
||||||
#ifdef DINPUTS
|
#ifdef INPUTS
|
||||||
int InState[Inputs];
|
int InState[Inputs];
|
||||||
int oldInState[Inputs];
|
int oldInState[Inputs];
|
||||||
#endif
|
#endif
|
||||||
@ -148,7 +148,7 @@ uint16_t value = 0;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
#ifdef DINPUTS
|
#ifdef INPUTS
|
||||||
//setting Inputs with internal Pullup Resistors
|
//setting Inputs with internal Pullup Resistors
|
||||||
for(int i= 0; i<Inputs;i++){
|
for(int i= 0; i<Inputs;i++){
|
||||||
pinMode(InPinmap[i], INPUT_PULLUP);
|
pinMode(InPinmap[i], INPUT_PULLUP);
|
||||||
@ -209,17 +209,17 @@ void loop() {
|
|||||||
comalive(); //if nothing is received for 10 sec. blink warning LED
|
comalive(); //if nothing is received for 10 sec. blink warning LED
|
||||||
|
|
||||||
|
|
||||||
#ifdef DINPUTS
|
#ifdef INPUTS
|
||||||
readInputs(); //read Inputs & send
|
readInputs(); //read Inputs & send data
|
||||||
#endif
|
#endif
|
||||||
#ifdef AINPUTS
|
#ifdef AINPUTS
|
||||||
readAInputs();
|
readAInputs(); //read Analog Inputs & send data
|
||||||
#endif
|
#endif
|
||||||
#ifdef LPOTIS
|
#ifdef LPOTIS
|
||||||
// readLPoti(); //read LPotis & send
|
readLPoti(); //read LPotis & send data
|
||||||
#endif
|
#endif
|
||||||
#ifdef ABSENCODER
|
#ifdef ABSENCODER
|
||||||
readAbsKnob(); //read ABS Encoder & send
|
readAbsKnob(); //read ABS Encoder & send data
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -268,6 +268,7 @@ void writeOutputs(int Pin, int Stat){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void writePwmOutputs(int Pin, int Stat){
|
void writePwmOutputs(int Pin, int Stat){
|
||||||
for(int x = 0; x<PwmOutputs;x++){
|
for(int x = 0; x<PwmOutputs;x++){
|
||||||
if(PwmOutPinmap[x]==Pin){
|
if(PwmOutPinmap[x]==Pin){
|
||||||
@ -281,8 +282,8 @@ void writePwmOutputs(int Pin, int Stat){
|
|||||||
int readLPoti(){
|
int readLPoti(){
|
||||||
for(int i= 0;i<LPotis; i++){
|
for(int i= 0;i<LPotis; i++){
|
||||||
int State = analogRead(LPotiPins[i][0])+margin;
|
int State = analogRead(LPotiPins[i][0])+margin;
|
||||||
Lpoti[i] = 1024/LPotiPins[i][1];
|
Lpoti[i] = 1024/(LPotiPins[i][1]-1);
|
||||||
State = State/LPotiPins[i][1];
|
State = State/(LPotiPins[i][1]-1);
|
||||||
if(oldLpoti[i]!= State){
|
if(oldLpoti[i]!= State){
|
||||||
oldLpoti[i] = State;
|
oldLpoti[i] = State;
|
||||||
sendData('L', LPotiPins[i][0],oldLpoti[i]);
|
sendData('L', LPotiPins[i][0],oldLpoti[i]);
|
||||||
|
17
arduino.py
17
arduino.py
@ -50,20 +50,20 @@ connection = '/dev/ttyACM0'
|
|||||||
|
|
||||||
|
|
||||||
# Set how many Inputs you have programmed in Arduino and which pins are Inputs
|
# Set how many Inputs you have programmed in Arduino and which pins are Inputs
|
||||||
Inputs = 17
|
Inputs = 16
|
||||||
InPinmap = [32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]
|
InPinmap = [32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]
|
||||||
|
|
||||||
# Set how many Outputs you have programmed in Arduino and which pins are Outputs
|
# Set how many Outputs you have programmed in Arduino and which pins are Outputs
|
||||||
Outputs = 9
|
Outputs = 9
|
||||||
OutPinmap = [10,9,8,7,6,5,4,3,2]
|
OutPinmap = [10,9,8,7,6,5,4,3,2,21]
|
||||||
|
|
||||||
# Set how many PWM Outputs you have programmed in Arduino and which pins are PWM Outputs
|
# Set how many PWM Outputs you have programmed in Arduino and which pins are PWM Outputs
|
||||||
PwmOutputs = 2
|
PwmOutputs = 2
|
||||||
PwmOutPinmap = [12,11]
|
PwmOutPinmap = [13,11]
|
||||||
|
|
||||||
# Set how many Analog Inputs you have programmed in Arduino and which pins are Analog Inputs
|
# Set how many Analog Inputs you have programmed in Arduino and which pins are Analog Inputs
|
||||||
AInputs = 1
|
AInputs = 1
|
||||||
AInPinmap = [79]
|
AInPinmap = [94]
|
||||||
|
|
||||||
|
|
||||||
# Set how many Latching Analog Inputs you have programmed in Arduino and how many latches there are
|
# Set how many Latching Analog Inputs you have programmed in Arduino and how many latches there are
|
||||||
@ -72,7 +72,7 @@ LPotiLatches = [9,4]
|
|||||||
|
|
||||||
# Set if you have an Absolute Encoder Knob and how many positions it has (only one supported, as i don't think they are very common and propably nobody uses these anyway)
|
# Set if you have an Absolute Encoder Knob and how many positions it has (only one supported, as i don't think they are very common and propably nobody uses these anyway)
|
||||||
AbsKnob = 1
|
AbsKnob = 1
|
||||||
AbsKnobPos = 30
|
AbsKnobPos = 31
|
||||||
|
|
||||||
|
|
||||||
######## End of Config! ########
|
######## End of Config! ########
|
||||||
@ -159,12 +159,11 @@ while True:
|
|||||||
elif data[0] == "A":
|
elif data[0] == "A":
|
||||||
c.aIn = data[1]
|
c.aIn = data[1]
|
||||||
elif data[0] == "L":
|
elif data[0] == "L":
|
||||||
for port in range(LPotiLatches[latches]):
|
pass
|
||||||
if ("LPoti-%02d %" [port]) == data[1]:
|
|
||||||
c.LPotiKnob = data[1]
|
|
||||||
|
|
||||||
elif data[0] == "K":
|
elif data[0] == "K":
|
||||||
c.AbsKnob = data[1]
|
c.AbsKnob = data[1]
|
||||||
|
elif data[0] == "E":
|
||||||
|
arduino.printline("E:")
|
||||||
else: pass
|
else: pass
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user